I'm pretty new to AngelScript and I've run into a problem with a 64-bit build on Mac OS X 10.7. I'm using the latest Xcode 4.2 tools (GCC 4.2.1, Clang 3.0).
The first problem is that a 64-bit build of AngelScript 2.22.0 isn't possible under Clang, the 32-bit build is fine though. The specific error it gives is:
$ clang++ -c -arch x86_64 source/as_callfunc_x64_gcc.cpp
fatal error: error in backend: Inline asm clobbers must be last on the x87 stack
You can get around this easily enough by using GCC instead of Clang. You can also make the error go away by commenting out the 'retval = call();' line in X64_CallFunction() but that obviously makes the whole thing non-functional!
[hr]
The second problem is that, having switched from Clang to GCC, enabling any optimizations at all triggers crashes when calling a simple global function:
The crash is inside CallSystemFunctionNative() in as_callfunc_x64_gcc.cpp. Building 64-bit AngelScript under GCC with no optimizations gets rid of the crash, as does switching to a 32-bit build.
Any insight on the above two issues would be much appreciated.
Unfortunately I don't know anything about Clang, so I can't help you on those questions.
As for the crash with gcc, it sounds a lot like the problem that was fixed in version 2.22.0. I got confirmation from another developer that also use Mac OS X 64bit that it was working properly. I guess you're using a sligthly different configuration than he do.
Unfortunately I do not have a Mac OS X 64bit environment to make any tests or debugging, so I hope you can do a little indepth investigation on your own to find the problem. The problem is most likely with the inline assembly since you say it works without the optimizations. The GCC optimizations must be making some assumptions that are not true with the inline assembly that I have in as_callfunc_x64_gcc.cpp. I'm probably overwriting some register that the optimizer used to store some value, or maybe the alignment of the stack is not the same on Mac OS X 64bit as it is on Linux 64bit.
The crash you were facing on Mac OS X 64bit has probably been fixed now. I've made a fix with the help from dutt who was also facing a crash on Mac OS X 64bit. Please give revision 1069 a try and see if it works for you too.