Jump to content
  • Advertisement
Sign in to follow this  
SiS-Shadowman

References and uninstanciable objects

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've registered an object like this:
Engine->RegisterObjectType( "Helper", 0, asOBJ_REF );
Engine->RegisterObjectBehaviour("Helper", asBEHAVE_ADDREF, "void f()", asMETHOD(CHelper, AddRef), asCALL_THISCALL);
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 this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!