Jump to content

[SOLVED] Plugin using other .dlls


photo

Recommended Posts

I'm trying to write a C++ plugin to add some to add some functionality of an external dll library into unigine.

So what I did was create a Plugin.dll to load into Unigine, and that plugin in turn calls function from the external dll library.

My plugin code looks like this:

 

class MyPlugin: public Unigine::Plugin
{
public:
 MyPlugin() { }

 virtual ~MyPlugin() { }

 virtual int init()
 {
  Unigine::Log::warning("HeadtrackingPlugin::init() is called\n");

  ExternalLib::do_something();

  return 1;
 }

 virtual int shutdown()
 {
  Unigine::Log::warning("HeadtrackingPlugin::shutdown() is called\n");
  return 1;
 }

 virtual void update() { }
};

extern "C" UNIGINE_API void *CreatePlugin() {
return new MyPlugin();
}

extern "C" UNIGINE_API void ReleasePlugin(void *plugin) {
delete static_cast<MyPlugin*>(plugin);
}

 

If I take out the line ExternalLib::do_something(); everything works fine (I see the log messages), but when I leave the line in Unigine crashes without any error messages.

There are no error messages in the log file either.

 

I put the external dll in the same folder as the Unigine executable.

 

Does anyone know what could be causing the crash?

Edited by Linus
Link to comment

Could you post the entire source code ?

 

I've made a head tracking system without any problems using Unigine plugins. (Intersense inertia Cube 2 and Razer Hydra)

 

Which hardware / software are you using ?

Link to comment

Don't see anything that hurts me.

 

Perhaps are you mixing debug build with release one ? Using different common runtime ?

 

If you build a fake standalone application (i.e. not using unigine at all) using your head tracker class, everything works properly ?

Link to comment

I made a standalone application and it ran without any problems. I found the problem when I compared the project settings of the standalone app and the dll.

Turns I just forgot to add a preprocessor definition for the camera SDK in the plugin project. :)

The plugin works fine now.

 

Thanks for helping out

Link to comment
×
×
  • Create New...