Jump to content

[SOLVED] Plugin-class can't be called inside script


photo

Recommended Posts

Okay guys,

 

after having some problem creating a dll-file with my Evaluation kit, I got it working. Now I have tried to call the class inside my (world) script-file, but without any success. I tried following different solutions:

 

  1. Call the Plugin with extern_plugin. Command-window shows the initialisation. Calling any class or function crashes Unigine. ("... unknown token "MyExternClass")
  2. Call the plugin with extern_plugin AND engine.addPlugin() in unigine.cpp. Calling the second function give me a notice in command window, that the plugin is already loaded. After using any function or class from my plugin Unigine crashed ("... unknown token "MyExternClass").
  3. Call the plugin with engine.addPlugin() in unigine.cpp OR world.cpp. Still same issue as before.

 

Strange thing I although noticed: Any log-messages in my plugin will only be shown in command window and not written in the log-file.

 

I used the latest Evaluation Kit. Log file is attached.

 

log.html

Link to comment

may be you can add your plugin to unigine.cfg, and make you plugin output something when Plugin::init was called. so this can make sure plugin is loaded when engine start.

 

and with debug version of engine. you can enable EXPORT_EXTERN define in data\core\scripts\system\system.h, then run the debug version of engine. you can see the extern_info.h file under your data folder, this will contain all the classes, functions, enums defined in engine ( of course with all loaded plugins info ), but this requires you load the plugin in unigine.cfg or with command line option.

 

with above two steps, you can make sure your plugin is loaded correctly, and registered the class correctly.

Link to comment
By the way, EXPORT_EXTERN can have different values:

 

log all functions:

main -extern_define EXPORT_EXTERN

 

log only engine functions:

main -extern_define EXPORT_EXTERN=1

 

log only plugin functions:

main -extern_define EXPORT_EXTERN=2
Link to comment

Thanks steve and binstream for your tipps.

I've got it worked and all seems to be fine now. If anyone has the problem too, use the Visual studio project from samples/api/plugin. I noticed, that I had some problems with my building variables. Second I didn't need any preprocessor definition for debug/release build.

 

Thank you all for your help.

Link to comment
×
×
  • Create New...