Skip to main content
GameDev.net gamedev.net
🔒 Locked

registering specialized template class?

Started by slicer4ever Oct 4, 2012 at 6:32 PM 5 replies 1.5k views
Original Post
slicer4ever
slicer4ever
I'm attempting to register several specialzed template classes, but i keep getting the error: "Error : Failed in call to function 'RegisterObjectType' with 'LLObject' (Code: -8)"

i'm registering it like so:


m_ScriptEngine->RegisterObjectType("ConvexHull", sizeof(ConvexHull), asOBJ_REF|asOBJ_NOCOUNT);
m_ScriptEngine->RegisterObjectType("LLObject<ConvexHull@>", 0, asOBJ_REF|asOBJ_NOCOUNT);


any tips on what i'm doing wrong?, if you need more code, i can post more, just tell me w/e u need.

edit: also, i'm using AS 2.25.0
WitchLord
WitchLord
Have you registered the LLObject template first?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
slicer4ever
slicer4ever
yes, i've tried it with declaring it as a template, before i declared the specialized class like so:


m_ScriptEngine->RegisterObjectType("ConvexHull", sizeof(ConvexHull), asOBJ_REF|asOBJ_NOCOUNT);
m_ScriptEngine->RegisterObjectType("LLObject<class T>", 0, asOBJ_REF|asOBJ_NOCOUNT|asOBJ_TEMPLATE);
m_ScriptEngine->RegisterObjectType("LLObject<ConvexHull@>", 0, asOBJ_REF|asOBJ_NOCOUNT);


but this still results in the same error code.
WitchLord
WitchLord
It might be a bug in AngelScript when parsing the template specialization with the handle as subtype. I'll investigate it.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
slicer4ever
slicer4ever

It might be a bug in AngelScript when parsing the template specialization with the handle as subtype. I'll investigate it.


Thanks Andreas, in the meantime, I can probably come up with an alternative solution, not exactly what i'd like, but it'll have to do for now=-).
WitchLord
WitchLord
The registration was failing because the LLObject template type didn't have a default constructor, which AngelScript treated as if the template type cannot be instanciated at all.

I've fixed this in revision 1424.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - <a href="http://www.angelcode.com/tower" rel
slicer4ever
slicer4ever
thanks Andreas=-), i've successfully templated several types without any complaints from the compiler so far.

I'll post a response if i run into any more issues.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.