Quote: "Its saying g_pGlob is undefined. Did I miss a step? I added the Globstruct properly cause I use it all the time, and I added the Windows use to the list.
What step did I do wrong?"
You need to declare a global variable
var g_pGlob: PGlobStruct;
and assign the structure to it in your ReceiveCorePtr procedure (see my tutorial for details).
GogetaX's way will work too but is slower.
As for returning floats from DBP Dll function usually you'll get away with the method GogetaX and me showed, however to be absolutely sure you'd have to do something like this:
function DBProObjXPos(ObjNum: LongInt): Single;
Type TGetObjectXPos = function(Id: LongInt): Integer; cdecl;
var GetObjectXPos: TGetObjectXPos;
tempInt: Integer;
begin
GetObjectXPos := GetProcAddress(g_pGlob.g_Basic3D, '?GetXPositionEx@@YAKH@Z');
tempInt:= GetObjectXPos(ObjNum);
CopyMemory(@result, @tempInt, 4)
end;
This is because DBpro expects single precision floating point results in the EAX register rather than on the FPU stack.