Problem Loading planet dlls from external application

Mindblast

Donator
Donator
Joined
Aug 29, 2008
Messages
171
Reaction score
0
Points
16
Location
Berlin
Website
www.nestadlinn.de
As the topic says.. i'm trying to load the standard planet module dlls like earth.dll and such from an external MSVC++ application using LoadLibrary(). While trying this i discovered that they depend on orbiter.exe and i get a Message Box saying that orbiter.exe couldn't be found when loading the dll. I have tried loading orbiter.exe with LoadLibrary too before loading the dll. Loading the exe succeeds but then i get a 0xC0000005: Access violation when loading the dll. Using dependency walker i found out that the dll uses several library functions from within the orbiter.exe (CELBODY class, CameraMode stuff etc.). I couldn't figure out a way to let the loaded dll access those functions from the orbiter.exe i loaded with LoadLibrary.
I would appreciate any help with this.
I'm planning to make an external navigation tool for orbiter and it would be cool if i could get the ephemerides data directly from the planet modules.
 
Last edited:

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,353
Reaction score
20
Points
113
Location
Sydney, Australia
I'm guessing that this is because when the planet modules are built they are statically linked to Orbitersdk.lib which gives them a DllMain(). That DllMain is structured to register the dll with Orbiter when Orbiter loads it. Perhaps the DllMain in the planet module can't find the functions it needs in Orbiter.exe when it is not actually running as a separate process?

An alternative would be to write a plugin to export the ephemerides from Orbiter, or in the beta, Orbiter_ng.

What about using the SOFA library? http://www.iau-sofa.rl.ac.uk/2009_0201_C/sofa/plan94.html
 

Mindblast

Donator
Donator
Joined
Aug 29, 2008
Messages
171
Reaction score
0
Points
16
Location
Berlin
Website
www.nestadlinn.de
Hmm SOFA looks interesting.. though it seems it has only calculations for the 8 planets, no moons, no dwarf planets, or did i overlook something ?

Getting access to the planet modules from a plugin inside orbiter should actually work.. i'll have to try that. I'll have to write some kind of MFD or Plugin for doing burns anyway.
 

tblaxland

O-F Administrator
Administrator
Addon Developer
Webmaster
Joined
Jan 1, 2008
Messages
7,353
Reaction score
20
Points
113
Location
Sydney, Australia
Hmm SOFA looks interesting.. though it seems it has only calculations for the 8 planets, no moons, no dwarf planets, or did i overlook something ?
No you haven't missed anything. Perhaps NOVAS-C would be of more interest to you. It can interface with JPL major body ephemeris software and USNO/AE98 software. There is quite some work involved though, and I haven't tried it personally.
 

Mindblast

Donator
Donator
Joined
Aug 29, 2008
Messages
171
Reaction score
0
Points
16
Location
Berlin
Website
www.nestadlinn.de
Short update.. I was able to load the planet dlls from within an orbiter plugin/mfd which then turned out to be not really necessary as i learned i can just request a pointer to the CELBODY interface of a planet via the API (that is if the planet supports it). :D

I looked briefly at NOVAS-C too.. this seems to be the complete solution if you really want to do it right but i guess i will just keep it simple for a start.
For now i will just work with standard Kepler orbits for the planets and see what the accuracy is like.
Anyway thanks tblaxland for pointing me in the right direction.
 

mjessick

Donator
Donator
Joined
Apr 26, 2008
Messages
174
Reaction score
0
Points
0
Location
Houston
I followed the same trajectory and ended up just writing the planet data out from an MFD at daily intervals for further processing with an offline program.
 

Mindblast

Donator
Donator
Joined
Aug 29, 2008
Messages
171
Reaction score
0
Points
16
Location
Berlin
Website
www.nestadlinn.de
Hmm interesting.. is there even a way to get orbit elements for a planet or moon from the API ? I didn't find anything.. seems i'll have to calculate them from position, velocity and central body mass.
 
Top