Compiling a .dll from bmx code?

BlitzMax Forums/BlitzMax Programming/Compiling a .dll from bmx code?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm having trouble trying to get that to work..

DLLTest2.bmx
Strict
Framework brl.blitz

Function GetData( output:Int Var)
  output = 10
EndFunction


DllCaller2.bmx
Strict
Framework brl.blitz

Import pub.win32


Global data:Int = 0

Local Library = LoadLibraryA ( "DLLTest2.dll" )
If Not Library
  WriteStdout "Library not found!~n"
  Return
EndIf
Local GetData ( A ) = GetProcAddress ( Library , "GetData" )
If Not Getdata
  WriteStdout "GetData function not found!~n"
  Return
EndIf
GetData( data )
WriteStdout data
FreeLibrary Library

Extern "Win32"
  Function FreeLibrary ( Library )
EndExtern


DLLTest2.def
EXPORTS
GetData=bb_GetData



I get "Unhandled Memory Exception Error" when trying to call "GetData( data )".