Sign in to follow this  
B_old

asWRONG_CALLING_CONV when compiling on Ubuntu (written on Windows)

Recommended Posts

B_old    689

Code that was written on Win 7 x64 produces the asWRONG_CALLING_CONV error when compiled under Ubuntu 12.10 x64. I have checked the asGetLibraryOptions() string and it does not contain AS_MAX_PORTABILITY.

 

Any idea what could be wrong with this code?

	struct floaty2
	{
		float x;
		float y;

		floaty2(float x, float y) : x(x), y(y)
		{}
	};

	void floaty2_init_constructor(float x, float y, floaty2* self)
	{
		new(self) floaty2(x, y);
	}

		engine.register_object_type("floaty2", sizeof(floaty2), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CA);

		engine.register_object_property("floaty2", "float x", offsetof(floaty2, x));
		engine.register_object_property("floaty2", "float y", offsetof(floaty2, y));

		engine.register_object_behavior("floaty2", asBEHAVE_CONSTRUCT, "void f(float, float)", asFUNCTION(floaty2_init_constructor), Script_engine::Calling_convention::C_decl_obj_last);

The angelscript relevant parts are wrapped in a very thin layer, I hope you can still read the actual calls beneath it.

 

 

Share this post


Link to post
Share on other sites
WitchLord    4677

Does your Script_engine::Calling_conventions::C_decl_obj_last actually match the value of asCALL_CDECL_OBJLAST?

 

Observe, the value of asCALL_CDECL_OBJLAST has changed in release 2.26.0 with the introduction of the new enum asCALL_THISCALL_ASGLOBAL.

Share this post


Link to post
Share on other sites
B_old    689

Damn, that was exactly the problem. Quite stupidly done on my side...

 

But now I have different problem.

engine.register_object_type("float3", sizeof(float3), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CA);

engine.register_function("float3 normalize(const float3 &in)", asFUNCTIONPR(normalize, (const float3&), float3));

 

This gives me the following message:

Don't support returning type 'float3' by value from application in native calling convention on this platform

 

Maybe I need different object flags?

 

EDIT

OK, I found the part in the documentation where it tells me to use asOBJ_APP_CLASS_ALLFLOATS

Edited by B_old

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this