Will the Win32 version of BMAX be able to compile a DLL?
Will BlitzMax be able to compile DLL's?
BlitzMax Forums/BlitzMax Programming/Will BlitzMax be able to compile DLL's? Yeah, but will it be able to? I part of the basic plan, but now I am not sure.
[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.
Adding "win32" after the function did the trick!
Thanks!!! :)
By the way, how did you know that?
Thanks!!! :)
By the way, how did you know that?
Mark mentioned it in a bug topic I created, todo with windowproc callback (win api)
Does anyone know if the dlls can share classes?
No, but will BlitzMax support it? I am not interested in some hacked-up "unofficial" solution that will break down when the system gets more complicated.