Will BlitzMax be able to compile DLL's?

BlitzMax Forums/BlitzMax Programming/Will BlitzMax be able to compile DLL's?

JoshK(Posted 2005) [#1]
Will the Win32 version of BMAX be able to compile a DLL?


tonyg(Posted 2005) [#2]
Not as far as anybody (even apparently BRL) know at the moment...
LINK


JoshK(Posted 2005) [#3]
Yeah, but will it be able to? I part of the basic plan, but now I am not sure.


Sweenie(Posted 2005) [#4]
[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.
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.


skn3(Posted 2005) [#5]
try doing ..
function test()"stdcall"
end function


might work, you could also try "win32"


Sweenie(Posted 2005) [#6]
Adding "win32" after the function did the trick!
Thanks!!! :)

By the way, how did you know that?


skn3(Posted 2005) [#7]
Mark mentioned it in a bug topic I created, todo with windowproc callback (win api)


Azathoth(Posted 2005) [#8]
Does anyone know if the dlls can share classes?


JoshK(Posted 2005) [#9]
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.