If you are making a DLL that uses other DLLs

BlitzMax Forums/BlitzMax Programming/If you are making a DLL that uses other DLLs

JoshK(Posted 2008) [#1]
You must detach the other DLLs (FreeLibrary) in a command other than the DLL detach function. In other words, your DLL MUST have an "EndProgram" function to detach any DLLs it uses. You cannot detach other DLLs in the DLL detach function, nor can you just end the program without causing an error:
http://msdn.microsoft.com/en-us/library/ms683152(VS.85).aspx

I have found that a DLL that loads other DLLs must do so in a separate function as well. For instance, you can't rely on the BlitzMax OpenAL module in a DLL, because that automatically loads the OpenAL DLL when your DLL is initialized. You have to have some kind of initialization function in which the OpenAL DLL is loaded.


JoshK(Posted 2008) [#2]
Another tip:
Use GC mode 2!!!