• Create Account

### #ActualAndreas Jonsson

Posted 29 March 2013 - 01:29 PM

Well, contrary to my initial thoughts I found that it was indeed that the class A had been registered incorrectly. Even though this class doesn't have it's own destructor, copy constructor, or assignment operator it should still be registered with the flags asOBJ_APP_CLASS_CDAK. Why? Because the member 'string text' has all of these.

Even I wasn't aware of this, and I'll have to update the manual with this new knowledge.

I'm not sure why this didn't break with MinGW 4.4.1, as I don't have that version of MinGW to test with. But I did test it with MinGW 4.6.2 and it also failed in the same way as MinGW 4.7.1 so this was not related to the ABI changes that were made in MinGW 4.7.

The new asGetTypeTraits<type>() helper function that you helped me implement returns the correct flags.


int r = engine->RegisterObjectType("A", sizeof(A), asOBJ_VALUE | asGetTypeTraits<A>()); assert( r >= 0 );


### #1Andreas Jonsson

Posted 29 March 2013 - 01:22 PM

Well, contrary to my initial thoughts I found that it was indeed that the class A had been registered incorrectly. Even though this class doesn't have it's own destructor, copy constructor, or assignment operator it should still be registered with the flags asOBJ_APP_CLASS_CDAK. Why? Because the member 'string text' has all of these.

Even I wasn't aware of this, and I'll have to update the manual with this new knowledge.

I'm not sure why this didn't break with MinGW 4.4.1, as I don't have that version of MinGW to test with. But I did test it with MinGW 4.6.2 and it also failed in the same way as MinGW 4.7.1 so this was not related to the ABI changes that were made in MinGW 4.7.

n the latest SVN I added a new helper function to automatically determine the correct flags to use. It relies on the new C++11 features, so you won't be able to use it with MinGW 4.4.1, but with MinGW 4.7.1 it works properly.


int r = engine->RegisterObjectType("A", sizeof(A), asOBJ_VALUE | asGetTypeTraits<A>()); assert( r >= 0 );


PARTNERS