Jump to content

Possible problem with TypeID


photo

Recommended Posts

Posted

In a part of code:


Unigine::ArrayMap NodeMap = Unigine::Interpreter::getArrayMap(_nodeMap);
int size = NodeMap.size();

for(int id=0; id < size; id++ )
{
Unigine::Node* nodePtr = (Unigine::Node*) NodeMap.get( Unigine::Variable( id ) ).getExternClassObject(
	Unigine::TypeInfo( Unigine::TypeID<Unigine::Node*>() ) );
...
}

 

getExternClassObject causes an error:

"Variable::getExternClassObject(): can't convert extern class to class Unigine::Node *"

 

Condition (type_info == TypeInfo(TypeID<Node*>())) in Variable::getExternClassObject(const TypeInfo &type_info) is false,

but both names in TypeInfo's are the same "class Unigine::Node *", the problem is they have different ids.

 

This is probably caused by initialization of

template <class Type> int TypeID<Type>::id = get_type_id(); in a header (UnigineType.h) - there are two separate instances of

TypeID<Unigine::Node*>::id, one in a dll and one in executable.

Posted

Hello,

 

Check source\samples\Api\Nodes sample. Create exe and load the nodes.world. You will get following error. The error is the same reason as of this discussion. TypeInfo.

 

post-41-0-28429800-1295927774_thumb.jpg

 

Please anyone answer this from Unigine team? Its a serious bug.

Posted

Thank you for this crucial bug. Visual studio has own opinion on templates instantiation order. There was no error on gcc.

×
×
  • Create New...