[Edit:] Standard calling convention works now thanks to skn3[ac]
Edited the code below to include parameters in the function
[/Edit]
I managed to create a dll with an exported function
This is how i did it...
First i created a module called sweenie.mydll(I only managed to do it with modules)
In that module I created a function called AddNumbers.
Then I compile this module and a file called mydll.bmx.o will be created under the .bmx folder where the module is located.
The function inside mydll.bmx.o will now be called sweenie_mydll_AddNumbers
To export this function i create a file called mydll.def containing this...
I could have just typed "sweenie_mydll_AddNumbers" directly but by putting "AddNumbers =" before I rename
the function to a more suitable length.
Then from the mingw bin folder i call this command...
gcc -shared -o c:\mydll.dll c:\bmax\mod\sweenie.mod\mydll.mod\.bmx\mydll.bmx.o c:\bmax\mod\brl.mod\blitz.mod\blitz.a c:\mydll.def
That's it.
Edited the code below to include parameters in the function
[/Edit]
I managed to create a dll with an exported function
This is how i did it...
First i created a module called sweenie.mydll(I only managed to do it with modules)
In that module I created a function called AddNumbers.
Function AddNumbers:Int(x:int,y:int) Return x+y End Function
Then I compile this module and a file called mydll.bmx.o will be created under the .bmx folder where the module is located.
The function inside mydll.bmx.o will now be called sweenie_mydll_AddNumbers
To export this function i create a file called mydll.def containing this...
EXPORTS AddNumbers = sweenie_mydll_AddNumbers
I could have just typed "sweenie_mydll_AddNumbers" directly but by putting "AddNumbers =" before I rename
the function to a more suitable length.
Then from the mingw bin folder i call this command...
gcc -shared -o c:\mydll.dll c:\bmax\mod\sweenie.mod\mydll.mod\.bmx\mydll.bmx.o c:\bmax\mod\brl.mod\blitz.mod\blitz.a c:\mydll.def
That's it.