asWRONG_CALLING_CONV when compiling on Ubuntu (written on Windows)

Started by
2 comments, last by WitchLord 11 years, 1 month ago

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.

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.

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

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!

:)

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