C++ dll and blitzmax

BlitzMax Forums/BlitzMax Programming/C++ dll and blitzmax

Why are you using extern to define the functions from the dll? (in fact, your not even loading a dll)

Here's what I've got so far:
SuperStrict

Framework brl.standardio
Import brl.stream
Import pub.win32
Import pub.stdc


Global Lib_Name:String = "EasyRPG116.dll"
Global Lib_Handle:Int = LoadLibraryA(Lib_Name)

Global l_USER_LOAD(file:Byte ptr, _CUserInfo:Byte ptr) = GetProcAddress(Lib_Handle, "?USER_Load@@YAHPBDAAVCUserInfo@@@Z")


Local file:String = "adminz_08.use", fuzz:Byte Ptr

l_USER_LOAD(file, fuzz)

DebugStop

FreeLibrary(Lib_Handle)

End

Extern "win32"
	Function FreeLibrary(hLibrary:Int)
	
End Extern


You might notice the weird function name, "?USER_Load@@YAHPBDAAVCUserInfo@@@Z", using notepad I found the actual export name for the function I want to use. In a debugger I found the parameters.

It gets the address to the function fine - no "Attempt to call uninitialized function pointer" errors.

When I try to call it, however, I get this: Unhandled Memory Exception Error at l_USER_LOAD(file, fuzz).
I'm not entirely certain I have _CUserInfo correct..

EDIT: Do I have to call DllEntryPoint, or is that done by LoadLibraryA()?