# References and uninstanciable objects

This topic is 3605 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've registered an object like this:
Engine->RegisterObjectType( "Helper", 0, asOBJ_REF );
Engine->RegisterObjectBehaviour("Helper", asBEHAVE_RELEASE, "void f()", asMETHOD(CHelper, Release), asCALL_THISCALL);

// CHelper *GetHelper()
Engine->RegisterGlobalFunction( "Helper @GetHelper()", asFUNCTION( GetHelper ), asCALL_CDECL )


When I write a script like this:
int main()
{
Helper m = GetHelper();
}


The build function fails with -1, but I don't get any compiler warnings. I then realized that I needed to make the variable a reference, but I wonder why the compiler doesn't tell me (I have set a message callback, but it isn't called). Did I do a mistake somewhere or is this a bug? Okay, I solved it, I used cdecl as the calling convention for a member method: changed it to thiscall, now the callback function does work. [Edited by - SiS-Shadowman on August 3, 2008 2:48:50 PM]

##### Share on other sites
You should have gotten some compiler error. I need to look into it.

##### Share on other sites
I do now, no need to look at it :)
I placed the wrong calling convention in the messagecallback registration, wich resulted in my callback never being called.

• 32
• 12
• 10
• 9
• 9
• ### Forum Statistics

• Total Topics
631352
• Total Posts
2999483
×