.dll Question When is dll executed

bitblit

New member
Joined
May 17, 2009
Messages
10
Reaction score
0
Points
0
I'm new to the OrbiterSDK. I successfully compiled a very basic DLL just to work out the mechanics of the tool chain. I can activate it in my modules list, but when are any of the function calls actually executed? I have instrumentation enabled for debug purposes, and I'm not seeing anything actually execute yet.
 
It is executed, when you load or unload it, or when a function of the DLL is called.
 
Specifically, the InitModule and ExitModule functions should be called when the module is loaded and unloaded respectively. If they are not, most likely you have not defined ORBITER_MODULE or for some reason Orbitersdk.lib has not been linked in. You have not declared a DllMain have you? If you do, it will cause problems because Orbitersdk.lib includes a DllMain already.

opcXXX type functions will be called at other times - refer to the documentation for more information.
 
You have not declared a DllMain have you? If you do, it will cause problems because Orbitersdk.lib includes a DllMain already.

What? -looks in the reference- I didn't know that :(
 
What? -looks in the reference- I didn't know that :(

This DllMain is only included in the DLL, if you also define "ORBITER_MODULE" as preprocessor symbol.
 
Of course, my dll does not contain a main(). That defeats the purpose of a dll. Not that I have the time to more thoroughly study the SDK, I think I need to create some more configuration files to associate a vehicle with the behavior defined in my dll. My debugger instrumentation is indicating that that none of my callbacks are called. I think that'll change when I finish the configuration.
 
What? -looks in the reference- I didn't know that :(
orbiterskd.lib is a static library that includes a DllMain function. It is linked in to your dll if you define ORBITER_MODULE. If you also define a DllMain in your dll, you will have problems. The DllMain in orbitersdk.lib has code in it to initialise your module in Orbiter.

Of course, my dll does not contain a main(). That defeats the purpose of a dll.
Not a main(), but a DllMain(), which is called automatically by the windows LoadLibrary function.

Not that I have the time to more thoroughly study the SDK, I think I need to create some more configuration files to associate a vehicle with the behavior defined in my dll. My debugger instrumentation is indicating that that none of my callbacks are called. I think that'll change when I finish the configuration.
Can you get this module to work? If we start with something simple & known, it will make debugging the problem easier:
http://www.orbiter-forum.com/showthread.php?p=79072#post79072
 
orbiterskd.lib is a static library that includes a DllMain function. It is linked in to your dll if you define ORBITER_MODULE. If you also define a DllMain in your dll, you will have problems. The DllMain in orbitersdk.lib has code in it to initialise your module in Orbiter.
No need for a lecture, I just didn't know that orbitersdk.lib implemented DllMain. Anyway, it isn't really a problem, as I never implement it.
 
I read more of the documentation. I was missing a lot more stuff before I should even see any function load.
 
Back
Top