Jump to content
  • Advertisement
Sign in to follow this  
yzslhawk

a question about asCALL_CDECL_OBJLAST

This topic is 3272 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

what is the difference of asCALL_CDECL_OBJLAST with asCALL_CDECL_OBJFIRST,when to use asCALL_CDECL_OBJLAST ? when to use asCALL_CDECL_OBJFIRST? who can give me an example?

Share this post


Link to post
Share on other sites
Advertisement
Manual: Register a function.

These two calling conventions can be used to register a global function as if it was a class method. Example:


void funcObjFirst(Object *o, int param)
{
o->func(param);
}

void funcObjLast(int param, Object *o)
{
o->func(param);
}

engine->RegisterObjectMethod("Object", "void funcObjFirst(param)", asFUNCTION(funcObjFirst), asCALL_CDECL_OBJFIRST);
engine->RegisterObjectMethod("Object", "void funcObjLast(param)", asFUNCTION(funcObjLast), asCALL_CDECL_OBJLAST);


The only difference between the two is where the object pointer goes, either as the first or the last parameter.

You usually use these calling conventions when you want to wrap some object functionality, but don't want to or cannot modify the original class.

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!