anthony.liot Posted July 29, 2013 Share Posted July 29, 2013 Hi, i have some difficulty with my Unigine Plugin.I have a plugin for create STS File (proprietary format similar to JSon), when i ue the plugin with the Unigine script i don't have any trouble i can create my STS object, add child , add value ... everything is all right.I have my QT app who embed Unigine, using qt app render. Inside my app i need to add some function to the script and one of them must return STS object. For that i put inside my plugin UNIGINE_API on my STS class, like that i can link my qt app with the Unigine plugin. My app (C++ part) use STS object and everything work. When i launch Unigine and call the function who must return STS i have this error : Variable::setExternClassObject(): can't find P3STS extern class Trying debug my bug, i print the map of Extern class inside Interpreter and the STS is present but apparently Unigine try to find an object with P3STS and not STS : Interpreter::findExternClass : P3STS Property Reflection RegExp STS Shape ShapeBox ShapeCapsule If somebody can help me that could help, i m lost... Thanks !!! Link to comment
frustum Posted July 29, 2013 Share Posted July 29, 2013 Can you provide a small sample which reproduces the problem? Link to comment
anthony.liot Posted July 29, 2013 Author Share Posted July 29, 2013 Hi Frustum, i did your small sample but it work !!!!!!! I must dig because i am using a lot of macro and is not so easy to extract just one little part. But apparently i have an error in my code. BTW i m using in my macro : Unigine::MakeExternObjectFunction , and in my small sample i use directly : Unigine::MakeExternFunction do you think that could be explain my trouble ??? Link to comment
anthony.liot Posted July 29, 2013 Author Share Posted July 29, 2013 I find a way who solve my trouble but not sure at all if is correct, theorically my macro have a function who return directly my type Res apply(PARAM_LIST##PNUM) { \ return (*_fnc)(PARAM_LIST_M##PNUM); \ } \ where Res is an STS in my case. I create a new macro specific for STS and the apply function return an Unigine::Variable : Unigine::Variable apply(PARAM_LIST##PNUM) { \ STS* sts = (*_fnc)(PARAM_LIST_M##PNUM); \ return Unigine::Variable("STS",sts);\ } \ aparrently seems working but not sure if i use corectly the Unigine API :( Link to comment
anthony.liot Posted July 30, 2013 Author Share Posted July 30, 2013 Hi, i rewrite the part of code inside Macro for do some other test and work perfect. My trouble must be inside my macro :(.Anyway Frustum for help me to find what i do wrong, why i have my STS type wit P3 prefix ?? Do you know what add this prefix ? Link to comment
frustum Posted August 24, 2013 Share Posted August 24, 2013 "P3" is an internal compiler RTTI name prefix. It depends on compiler. We are trying to remove all this internal staff from API. But sometimes this strange names can appear in error messages. Link to comment
anthony.liot Posted September 12, 2013 Author Share Posted September 12, 2013 Sorry I am back with my problem.It's only on windows apparently, I was thinking solve the bug, but I was wrong.I explain again my trouble, I have two plugin unigine (dll), -> first dll1 has function for create Sts file -> 2nd dll2 has function for link our database. Some function can return STS and other take STS how parameter. Of course for build this I link with dll1. After that when I launch Unigine I add -extern-plugin dll1,dll2. And I have bad crash about the function using STS inside dll2 call by Unigine.This same code seems work well on OSX. May be it's a misunderstanding about the Visual build/link option. But I am blocked. For solve partially the solution, It was necessary to add all the script interpreter method for STS inside the dll2 and don't add dll1 how extern plugin :(, a very dirty, bad solution.Some advice ?? Thanks Tony Link to comment
frustum Posted September 15, 2013 Share Posted September 15, 2013 Maybe you should declare shared functions as exported. Because exporting behavior is different between Windows and OSX. Under OSX all functions are exported by default. Link to comment
Recommended Posts