Advertisement

AngelScript in IPhone: Compiling errors

Started by April 27, 2010 08:38 AM
6 comments, last by Pogacha 13 years, 8 months ago
Hi, I´m trying to use AngelScript in iPhone but I´m getting some strange errors when compiling. It seems that there are problems when compiling for ARM. These are the errors: Undefined symbols: "_armFuncR0ObjLast", referenced from: CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o "_armFuncR0", referenced from: CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o "_armFunc", referenced from: CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o "_armFuncObjLast", referenced from: CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o "_armFuncR0R1", referenced from: CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o CallSystemFunction(int, asCContext*, void*)in as_callfunc_arm.o ld: symbol(s) not found collect2: ld returned 1 exit status And a lot of "std call ignored" It seems that I´m doing something wrong but I don´t know what. I read in previous posts that there are some preprocessor directives that I must use like __APPLE__ or TARGET_OS_IPHONE... Could someone help me with this problem? Tnaks a lot!!!
I just added as_callfunc_arm_gcc.S to the project and now I'm getting an error: Unknown pseudo-op: .global.
I made a research and it seems that in iphone I should use ".globl" instead of ".global". I made the change and it compiles and links ok but the AS engine crashes.

Any help whit this?
Advertisement
Ok, since I changed ".global" to ".globl" I´m beeing able to link and compile. I tried this simple script and it works OK:

void print()
{

}

void main()
{
print();
}

Then I tried to use a registered method but it crashes. I'm configuring the engine in this way:

int asResult = 0;
asResult = registerManageableClass( "InputOutput" );
assert( asResult >= 0 );
asResult = registerClassMethod( "InputOutput", "void print()", asMETHOD( DF2ScriptEngine, print ) );
assert( asResult >= 0 );
asResult = registerGlobalProperty( "InputOutput io", this );
assert( asResult >= 0 );

The print method just prints some string using printf and I'm calling the method from the script in this way: io.print();

It seems that I´m having problems with the method registration in Iphone. I tried the same thing in the simulator and it works ok. I suspects that I'm still doing something wrong since I needed to change that .global thing to compile and no one else is doing that.

Can anyone help me with this? I really like AngelScript and I want to use it in our iPhone game.

Thanks a lot!!
Just to be clear: registerManageableClass, registerClassMethod and registerGlobalProperty are methods created by us but inside they just call angelscript methods to made the registration.
I just tried with a Global Function and it works ok. I'm still not being able to register methods of a class.
Am I able to do that on Iphone? Could that problem be related with the way I'm compiling?
What compiler are you using?

If you're using xcode then you should add the file as_callfunc_arm_xcode.s instead of the file as_callfunc_arm_gcc.S. In the xcode file you'll see that it is already using .globl, so you were correct in that change.

You say it works on the simulator, but not on the actual iPhone? Looks like there is a slight difference in the calling convention on the simulator and the iPhone then. Unfortunately I don't think I will be able to investigate this. Hopefully someone from the community can take this up.

You can still use AngelScript without the native calling conventions by compiling the library with asMAX_PORTABILITY defined. This will take away the need for the assembler code, though you will have to use wrappers to register the functions with the asCALL_GENERIC interface instead.

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

Advertisement
I ran into the same issue as well, it works fine for global functions. But for class methods it is crashing in the CallSystemFunction at the switch ICC_VIRTUAL_THISCALL. The reason why it works on the simulator is because when you run the simulator on the mac it uses the x86 version of the CallSystemFunction instead of the arm version. Well i think the problem is definitely something that has to do with the assembly function for that specific condition.
I found a fix here:

#3

This topic is closed to new replies.

Advertisement