Question Newbie - Why is Module not loaded?

satelliteGuy

New member
Joined
Feb 25, 2010
Messages
10
Reaction score
0
Points
0
Hi,

I'm having a very basic problem: I wrote a DLL which only has InitModule and ExitModule. The DLL is placed in the Module/Plugin-Directory, and I can add it to the active modules (which I did).

However - the module is not loaded when I start a scenario (the only thing it does is open a file, write to it and close it - the code works when placed in a vessel-dll in the constructor). As the file does not exist, I conclude that the InitModule is NOT called as opposed to the description (or my understanding of it) or the module is not recognized properly

orbitersdk.h is included, and ORBITER_MODULE is defined.

What am I doing wrong (I am not a Windows-/Visual-C-buff. Under Linux I would be able to check for symbols in libraries etc, but Windows is still a mistery to me)?

And: where do I put config-stuff for plugin-modules?

Thx in advance

satelliteGuy

P.S.: Here's the code

#include "orbitersdk.h"

#define ORBITER_MODULE

DLLCLBK void InitModule ( HINSTANCE hDLL )
{
FILE* fp;
fopen_s ( &fp, "MyModule.cfg", "w" );
fclose ( fp );
exit(-1);
}

DLLCLBK void ExitModule ( HINSTANCE hDLL )
{
}
 
You put the stuff into the config folder and use the orbiter API functions for accessing it, since these check for redirected folders.

Init/Exit module should be called when you activate the module, AFAIR.
 
Try to comment out the exit(-1) line.

EDIT: Oh, and try out if it works with #define STRICT instead of #define ORBITER_MODULE
 
Last edited:
The problem is here:
#include "orbitersdk.h"
#define ORBITER_MODULE
A hint: Why do you think the ORBITER_MODULE is for?
Specifically, what can it do after orbitersdk.h have already been included?
 
The problem is here:
A hint: Why do you think the ORBITER_MODULE is for?
Specifically, what can it do after orbitersdk.h have already been included?

Yes, the problem was there. :thumbup:

Thinking might actually have helped.

If I would have checked the header, I might have figured it out myself. My fault: I only checked the documentation, which said that the directive needs to be defined - I did that without further thinking. If I would have checked the samples (which I did in the meantime and should have done in the first place), I might have figured it out myself.

Thx for the really quick help
 
Back
Top