Jump to content

[SOLVED] how to export new functions out to engine dll and use them in application?


photo

Recommended Posts

Hello all,

 

I need to expand some new functions and classes in unigine engine dll and call them in applications.

when i test this i always got link2019 errors. So Should anybody know how to do this please help.

 

for example In unigine engine project, I add a new class with the .h and .cpp file as follows(for test only):

 

globe.h

 

 

#ifndef __GLOBE_H__

#define __GLOBE_H__

/*

*/

#ifdef GLOBE_DLL

#define GLOBE_API __declspec(dllexport)

#else

#define GLOBE_API __declspec(dllimport)

#endif

class GLOBE_API Globe {

public:

Globe();

~Globe();

};

 

 

globe.cpp

 

#ifndef GLOBE_DLL

#define GLOBE_DLL

#endif

#include "Globe.h"

 

Globe::Globe()

{

}

 

Globe::~Globe()

{

}

 

 

 

then I create a new Globe instance in application which link the engine dll

 

int main(int argc,char **argv) {

Engine *engine = Engine::init(UNIGINE_VERSION,argc,argv);

 

Globe *globe = new Globe();

 

engine->main();

Engine::shutdown();

 

return 0;

}

 

it complains:

 

error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall Globe::Globe(void)" (__imp_??0Globe@@QAE@XZ),

Link to comment

hello, unclebob. i have defined the new class in Unigine engine dll project and want to export in the Unigine engine dll ,

while the native engine functions are OK, my new defined is not.

Link to comment
×
×
  • Create New...