Noob: Creating A Dll?
BlitzMax Forums/BlitzMax Beginners Area/Noob: Creating A Dll?
| ||
Can I create a .dll that other programs can use and if so, is there a walk through somewhere to do it? Thanks. |
| ||
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 |
| ||
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 |
| ||
Thanks! Ziggy - Every function I create has to have GCEnter()? What is this doing? What about GCLeave()? |
| ||
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. |
| ||
ok, thanks for the info. :) |
| ||
I guess you know creating dlls in BlitzMax is an experimental feature, you might want to use a compiler thats designed for it. |