Advertisement

Casting with generic call conv

Started by April 23, 2012 09:01 PM
13 comments, last by WitchLord 12 years, 10 months ago
I actualy added 3 macros:


#define WRAP_FNT(name) (::gw::id(name).template f< name >())
#define WRAP_MFNT(ClassType, name) (::gw::id(&ClassType::name).template f< &ClassType::name >())
#define WRAP_OBJ_LASTT(name) (::gw::id(name).template ol< name >())


WRAP_FNT is used when registering static class functions. For some reason I don't really understand right now I have to use WRAP_MFNT for my AddRef and Release functions. And WRAP_OBJ_LASTT for my constructors, what are basically static class functions, so that is sensible.

Also I had to modify as_config.h, moving the ANDROID block on top of the __linux__ block, ans android is a linux so the android is getting detected as a linux with ARM, which is true, but still not what you expect :)

Right now my framework runs on ANDROID with generic, and on PC with native. Generic on PC is crashing, but I think it is my bad, as it is crashing only on a specific function.
Thanks for confirming that the solution works. I'll make the necessary changes to the header and check in the code.


There was no need to add the new macros. They do exactly the same thing as the existing ones.

A static class method, is really just a global function, except it is declared in the scope of the class, that is why you need to use WRAP_FN for them.

The AddRef and Release methods are real class methods, which is why they need WRAP_MFN (Member FunctioN).


I'll update the as_config.h like you indicated. Thanks for that info too.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
I know when what WRAP_FN, WRAP_MFN and static functions mean. The solution is to use WRAP_FNT only for the AddRef and Release functions. They are common nonvirtual member functions. But there are other common nonvirtual member functions I've registered as well, but I only need to use WRAP_FNT for this two. Maybe because it has no parameters, nor a return value, or because they are not virtual. I don't know why I need to use it for this two.
I'll let you know when I figure it out.
I've checked in the changes in revision 1284.

Let me know if you find something else that needs to be modified to work properly on Android. In fact, have you tested it without the wrappers, i.e. with native calling conventions? As far as I know native calling conventions should be working on Android too, though I don't have an environment to really test this for myself.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

The code change didn't work on Linux with gnuc so I had to make further changes to include the template keyword only on ANDROID.

Can you verify if the code in revision 1285 works for you on Android?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement