Advertisement

asIScriptEngine::RegisterObjectType Issue on Mac

Started by August 24, 2009 04:39 AM
2 comments, last by BornToCode 15 years, 6 months ago
On Mac when i use the offset macro with RegisterObjectProperty i am getting this warning that says:"invalid acccess to non static data member Emotion2D::ActorProperty::script of NULL object.(perhaps the "offsetof" macro was used incorrectly" Now that is weird because that same code works on windows but on mac my offsets are getting all mess up and when i access stuff in the script. The wrong variables are getting modified. PS:this is how i have the RegisterObjectProperty set up right now. engine->RegisterObjectProperty("Sprite","string name",offsetof(ActorProperty,script.scriptidname));
Well it looks like this problem only happens when i load the precompiled script. If i recompile the script, everything seems to work. But that is weird though.
Advertisement
The offsetof() macro is part of the C standard headers. But it was only meant to be used with POD (plain-old-data) structures, not complex classes. That's why GNUC always warns about invalid access to non-static data member.

The reason for this warning is that the offsetof() macro will give different values on different platforms/compilers due to how each implement the class member layouts. This is also the reason why the pre-compiled bytecode that you compiled on the Windows machine fails when loaded on the Mac.

This would be yet another thing that would have to be fixed before the pre-compiled script code can be considered platform independent. Unfortunately it may require a bit more changes than just the asCRestore.







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

After i read your post. I decided to rebuild them again on the mac. And this time everything works. Man we definitely need to get precompiled scripts to work independently of the platform it is been run at. Having a system like would be awesome.

This topic is closed to new replies.

Advertisement