🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Can't register object method: "Invalid configuration"

Started by
13 comments, last by mono2k 17 years, 3 months ago
I'm trying out angelscript for an embedded (ARM linux) project, and having some issues with the class method bindings. I'm using the tutorial project and added a HelloWorld class to test out bindings. I added the following lines and everything seemed to compile fine.

engine->RegisterObjectType("HelloWorld", sizeof(HelloWorld), asOBJ_CLASS);
engine->RegisterObjectProperty("HelloWorld", "int value", offsetof(HelloWorld, value));
engine->RegisterObjectMethod("HelloWorld", "void Print()", asMETHOD(HelloWorld, Print), asCALL_THISCALL);

Here's the class header just in case

#ifndef _HELLOWORLD_H_
#define _HELLOWORLD_H_

class HelloWorld
{
public:
	
	void Print ();
	int value;
};

#endif // _HELLOWORLD_H_

But when I run the executable without changing the original script.as I get the following error.

sh-2.03# ./rxpclient
 (0, 0) : ERR  : Invalid configuration

Build() failed

Press any key to quit.
If I remove the RegisterObjectMethod() line, everything runs fine and I have access to the 'value' property from the script. Any help would be appreciated.
Advertisement
Wild guess: the space after the Print?
Well for one where is your constructor and destructor behaviors?

See http://angelscript.pbwiki.com/RegisterObjects for more info about registering objects.
It would seem that native calling conventions are not supported on your system.

You get 'Invalid Configuration' because one of your Register calls failed. You seem to have located which one already, but you may want to check the return code from the call. My guess is that you're receiving asNOT_SUPPORTED (-7).

If I'm right you should be able to register your method via a generic wrapper:

void HelloWorld_Print(asIScriptGeneric *gen){  HelloWorld *obj = (HelloWorld*)gen->GetObject();  obj->Print();}r = engine->RegisterObjectMethod("HelloWorld", "void Print()", asFUNCTION(HelloWorld_Print), asCALL_GENERIC); assert( r >= 0 );


What is your development target platform? I need to know OS, CPU, and compiler.

Not all combinations of these have support for native calling conventions yet. You can see the list of supported platforms here: Features

Regards,
Andreas

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

You're dead on about the -7.

My development system is an ARM11 (Marvell XScale PXA255). OS is an XScale based linux kernel 2.5.30, and I'm running arm-linux-gcc v2.95.3

But I'm sure you're right about it not being supported. I checked this out:
asGetLibraryOptions() and it said "AS_MAX_PORTABILITY."

Thanks for the help, I'll just write the wrappers.

~Mark
Cool! You found the asGetLibraryOptions(). I had forgotten about that one, but it is indeed the easiest way of determining if the native calling conventions are supported or not. :)

What kind of processor is this? Would you be interested in trying to add support for native calling conventions on it?

Basically you would have to implement a new as_callfunc_arm.cpp file. It requires a bit of knowledge in assembly and using a disassembler to figure out how parameters are passed in various situations. If the CPU is similar to one already supported, then perhaps it may just be needed to modify the as_config.h file to detect this CPU and set the flags so that the assembly routines for the calling conventions gets compiled.

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

I did some reading on the ARM architecture.

I'm especially interested in learning how well AngelScript works for you, because I would like to be able to add this CPU family to the list of supported CPUs, even though it doesn't have support for native calling conventions yet.

The ARM processor is used by many mobile devices, such as Nokia's NGage, Game Boy Advanced, Nintendo DS, etc. So it would be very cool to be able to say that AS works on those as well.

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

QEMU does support emulation of ARM processors, so you should be able to get Linux running under it. This might be enough if you want to add support for ARM.
Debian has an ARM port http://www.debian.org/ports/arm/, it should run under QEMU.
Thanks droz,

I'll probably never get around to do this myself, but it's good to know about these resources.

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