C++ Question Multiple vehicle-classes in one DLL?

satelliteGuy

New member
Joined
Feb 25, 2010
Messages
10
Reaction score
0
Points
0
I'm trying to implement a plugin with different vehicle-classes that need access to each other's API. Due to my not existing knowledge of MS and MS VC 2008 I'm looking for an easy way to solve this (which means putting all in one DLL).

So: Is it possible to create a DLL providing vehicles of different classes, which can also be instantiated while parsing (and being described) in the config-file using one DLL. My understanding is that the ovcInit-funciton is used by Orbiter to instantiate instances (as described in the class-config-file) - and that's why I don't think it will work. But I'm not really keen on fussing around with dllexport, dllimport etc to build different DLLs AND resolving all complaints from VC, that's why I'm asking.

Thx
 
Yes - you can switch between the classes by the configuration file, but you would still have to return a "stub" vessel first in ovcInit. Still no reason then, to not use for example an strategy design pattern for redirecting the orbiter call-backs to a special class.
 
Yes - you can switch between the classes by the configuration file, but you would still have to return a "stub" vessel first in ovcInit. Still no reason then, to not use for example an strategy design pattern for redirecting the orbiter call-backs to a special class.
That means defining the final class in the scenario-file and not the vehicle-file containing ClassName and Module - right? I though there might be a way to do this in the vehicle-config-file.
 
You can certainly define the class in the .cfg file. That's what I do in a number of cases, such as CVEL Titans and the Aries/Taurus/Aquarius/Herculis/etc ships from 2001. The procedure (which I borrowed shamelessly from dh219) is to string-compare the classname to a number of choices, and branch/set parameters accordingly.
 
You can certainly define the class in the .cfg file. That's what I do in a number of cases, such as CVEL Titans and the Aries/Taurus/Aquarius/Herculis/etc ships from 2001. The procedure (which I borrowed shamelessly from dh219) is to string-compare the classname to a number of choices, and branch/set parameters accordingly.
How do I get that information? I would need the info when ovcInit is called in order to return the proper class. I haven't really found the info in the manuals.
 
The Deltaglider code in the SDK samples defines two vessel classes: DeltaGlider and DG-S. Although they are similar (and share most of the code), technically they are separate vessel classes.

The most elegant way to construct this would be to define a base class which implements the communication interface between your vessels, and then derive different vessel classes from that.
 
You might want to look into KeyComm as a solution for having vessels pass messages back and forth. Depending on the nature of what you're doing, that might turn out to be easier.
 
You can also use dllexports to export your classes (or just some member functions - probably more secure). I did so to allow a plugin module to communicate with a vessel module for the Ananke project.
 
Decision made

Thx for all you help and suggestions. I think I will go with the strategy-approach (and keep the rest in the back of my head). This way I can use the scn-File to define the classes and properties.
 
Back
Top