- Joined
- Feb 2, 2012
- Messages
- 1,667
- Reaction score
- 104
- Points
- 78
Hi Guys,
I have a question which is pretty much for the C++ experts of the forum.
I'm starting to develop the SDK for my Space Network and, since I'm learning step by step this, I ecountered an issue that I don't know how to solve.
First, the good part:
I've created a SpaceNetworkSDK.h file which contains just the follow for the moment:
in my SpaceNetwork class implementation I have:
Now, I've tried this with the "official" Deltaglider code and it works like a charm: I just put "OrbiterRootOut()" in the DG's clbkPostStep and everything worked perfectly.
The point is: if I deactivate the SpaceNetwwork Module from the Orbiter Launchpad my poor Deltaglider gets crazy (no meshes on load, no fuel, nothing, clearly some memory issue). Now, of course I want the implementation to be compatible with everyone, so if the module is not loaded I'd like the functions simply not to return anything. How can I do that?
Since the module DLL is not loaded any code implementation in SpaceNetwork class is useless... that's why I need help from somebody expert!
Thanks in advance!
I have a question which is pretty much for the C++ experts of the forum.
I'm starting to develop the SDK for my Space Network and, since I'm learning step by step this, I ecountered an issue that I don't know how to solve.
First, the good part:
I've created a SpaceNetworkSDK.h file which contains just the follow for the moment:
Code:
#ifndef __SPACENETWORKSDK_H
#define __SPACENETWORKSDK_H
#pragma comment(lib,"SpaceNetwork.lib")
#define DLLEXPORT __declspec(dllexport)
#define DLLIMPORT __declspec(dllimport)
#ifdef SN_API_IMPLEMENTATION
#define SPACENETWORKFUNC DLLEXPORT
#else
#define SPACENETWORKFUNC DLLIMPORT
#endif
SPACENETWORKFUNC void OrbiterRootOut();
#endif
in my SpaceNetwork class implementation I have:
Code:
SpaceNetwork *SpaceN; // declared here a pointer to a global spacenetwork class instance
SpaceNetwork::SpaceNetwork(HINSTANCE hDLL) : oapi::Module(hDLL){
//... among the rest
SpaceN = this; setting the global pointer to the plugin instance, so I can use SpaceN whenever I want
}
void SpaceNetwork::OrbiterRootOut() {
sprintf(oapiDebugString(), "%s",orbiter_root);
return;
}
void DLLEXPORT OrbiterRootOut() { // using this because I want to export single methods, not the whole class
return SpaceN->OrbiterRootOut();
}
Now, I've tried this with the "official" Deltaglider code and it works like a charm: I just put "OrbiterRootOut()" in the DG's clbkPostStep and everything worked perfectly.
The point is: if I deactivate the SpaceNetwwork Module from the Orbiter Launchpad my poor Deltaglider gets crazy (no meshes on load, no fuel, nothing, clearly some memory issue). Now, of course I want the implementation to be compatible with everyone, so if the module is not loaded I'd like the functions simply not to return anything. How can I do that?
Since the module DLL is not loaded any code implementation in SpaceNetwork class is useless... that's why I need help from somebody expert!
Thanks in advance!