Time for action – Using DLLBind
One thing to note is that currently, DLLBind only works with the 32-bit code. If your ConTEXT or batch files are set up to run the Win64 folder's UDK.exe
, then you need to change it to run from Win32 for DLLBind to work. You will get a compiler warning about it if you try to compile with the Win64 UDK.exe
.
First up, we need to create the DLL. I've provided one in the files included with the book, but for reference sake, here is the code inside it:
#include "stdafx.h" #include <stdio.h> extern "C" { __declspec(dllexport) void DLLFunction(wchar_t* s) { MessageBox(0, s, L"DLL has been called!", MB_OK); } }
Basically, we're creating a function called DLLFunction
that takes a wchar_t
(equivalent of a string) and pops up an OK
box with the string as a message.
Grab
AwesomeDLL.dll
from the files included with the book and place the.dll
in theUDK-AwesomeGame\Binaries\Win32\UserCode
folder.Now for the UnrealScript side of things. We're going to use our...