Noob: Creating A Dll?

BlitzMax Forums/BlitzMax Beginners Area/Noob: Creating A Dll?

MGE(Posted 2008) [#1]
Can I create a .dll that other programs can use and if so, is there a walk through somewhere to do it? Thanks.


Perturbatio(Posted 2008) [#2]
You can create DLLs with BMK via command line or using BLide.

I think the commandline is something like:
bmk makelib mysource.bmx


*EDIT*
this might help a bit:
http://www.blitzbasic.com/Community/posts.php?topic=66616#744477


ziggy(Posted 2008) [#3]
You have to define the functions with "win32" and place a GCEnter sentence at the begining of the function to activate the garbage collection.
Example:
Function DoThis:int(Value:Long) "Win32"
   GCEnter()
   Return Value*2
End Function



MGE(Posted 2008) [#4]
Thanks! Ziggy - Every function I create has to have GCEnter()? What is this doing? What about GCLeave()?


ziggy(Posted 2008) [#5]
GCEnter enabled the garbage collector. when the DLL is used from an application (let's say a C application), GC won't be running when a function in the DLL is called, so the objects won't be released when de-referenced, causing memory leaks unless you add the GCEnter() command.


MGE(Posted 2008) [#6]
ok, thanks for the info. :)


Azathoth(Posted 2008) [#7]
I guess you know creating dlls in BlitzMax is an experimental feature, you might want to use a compiler thats designed for it.