BlitzMax options extendibility

BlitzMax Forums/BlitzMax Beginners Area/BlitzMax options extendibility

RupeB(Posted 2015) [#1]
Been a heavy Blitz3D user and just got started with BlitzMax and trying to grasp things. I wonder if BlitzMax supports the same extension and libraries via declarations or how does that work?

I imagine it differs as .dll is Windows only? What are the options in BlitzMax to add for example lowlevel access to OS in the same way Blitz3D did?


Bobysait(Posted 2015) [#2]
the windows libraries can be imported using the "Import" keyword followed by "-l" + "dll_name" (dll_name is the name of the library you want to import) then use Extern to map the functions

ex:
Import "-luser32"

The "decls" is actually your code
Extern 
	Function GetDC:int (hwnd:int) = "GetDC@4"
End Extern


for external dynamic libraries, you 'll need to load the library
-> LoadLibraryA

it will look like something like this
Local dll:Int = LoadLibraryA ("my_dll.dll")

Global MyDllFunction()

If dll
	MyDllFunction = GetProcAddress (dll, "dll_function_name")
EndIf;