![]() |
|
Orbiter SDK Orbiter software developers post your questions and answers about the SDK, the API interface, LUA, meshing, etc. |
![]() |
|
Thread Tools |
![]() |
#1 |
Orbinaut
|
![]()
Hello guys, I'm trying to compile a simple module following the API_Guide.
That's the code: Code:
// Dll1.cpp : Defines the exported functions for the DLL application. // #include "stdafx.h" //====================== //Module initialisation //====================== #define ORBITER_MODULE #include "orbitersdk.h" HINSTANCE g_hDLL; DLLCLBK void InitModule(HINSTANCE hModule) { g_hDLL = hModule; // perform global module initialisation here } DLLCLBK void ExitModule(HINSTANCE hModule) { // perform module cleanup here } //====================== //Vessel initialisation //====================== class MyVessel : public VESSEL2 { public: MyVessel(OBJHANDLE hObj, int fmodel) : VESSEL2(hObj, fmodel) {} ~MyVessel() {} // add more vessel methods here void clbkLoadStateEx(FILEHANDLE scn, void *status); void clbkSaveState(FILEHANDLE scn); void clbkSetClassCaps(FILEHANDLE cfg); private: double myparam; }; void MyVessel::clbkLoadStateEx(FILEHANDLE scn, void *status) { char *line; while (oapiReadScenario_nextline(scn, line)) { if (!_strnicmp(line, "MYPARAM", 7)) { sscanf_s(line + 7, "%lf", &myparam); } else { ParseScenarioLineEx(line, status); } } } void MyVessel::clbkSaveState(FILEHANDLE scn) { VESSEL2::clbkSaveState(scn); oapiWriteScenario_float(scn,"MYPARAM", myparam); } void MyVessel::clbkSetClassCaps(FILEHANDLE cfg) { SetEmptyMass(1000.0); SetSize(10.0); //AddMesh(oapiLoadMeshGlobal(“MyVessel.msh”)); // define vessel capabilities here } DLLCLBK VESSEL *ovcInit (OBJHANDLE hvessel, int flightmodel) { return new MyVessel (hvessel, flightmodel); } DLLCLBK void ovcExit(VESSEL *vessel) { if (vessel) delete (MyVessel*)vessel; } Code:
Dll1.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) void __cdecl oapiWriteScenario_float(void *,char const *,double)" ([email protected]@[email protected]) Code:
OAPIFUNC void oapiWriteScenario_float (FILEHANDLE scn, char *item, double d); Code:
OAPIFUNC void oapiWriteScenario_float (FILEHANDLE scn,const char *item, double d); Code:
oapiWriteScenario_float(scn,"MYPARAM", myparam); Code:
argument of type "const char*" is incompatible with parameter of type "char*" Code:
#ifdef ORBITER_MODULE void dummy(); void calldummy () { dummy(); } DLLCLBK char *ModuleDate () { return __DATE__; } #endif Code:
#ifdef ORBITER_MODULE void dummy(); void calldummy () { dummy(); } DLLCLBK const char *ModuleDate () { return __DATE__; } #endif Thanks in advance. |
![]() |
![]() |
![]() |
#2 |
Addon Developer
![]() |
![]() Quote:
Yeah, you can't change the OrbiterSDK files.... ![]() They are your interface to the Orbiter libraries, and those don't change once Martin compiles them. If there are any errors and/or warnings, it's because the user isn't respecting the interface. |
![]() |
![]() |
![]() |
|
Thread Tools | |
|
|
Quick Links | Need Help? |