• Advertisement
Sign in to follow this  

asWRONG_CALLING_CONV when compiling on Ubuntu (written on Windows)

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

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
Advertisement

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

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
Sign in to follow this  

  • Advertisement