🎉 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!

Error when running script on AMD64

Started by
2 comments, last by Gyrbo 17 years, 10 months ago
Hm. Now got angelscript compiled and installed, but have a problem registering methods and functions. The same problem shows up when trying to run the console app.

[rune@localhost source]$ g++ main.cpp ../../../add_on/scriptstring/scriptstring.cpp -langelscript
[rune@localhost source]$ ./a.out
a.out: ../../../add_on/scriptstring/scriptstring.cpp:591: void RegisterScriptString(asIScriptEngine*): Assertion `r >= 0' failed.
Avbrutt (SIGABRT)

The same thing works on my laptop (which is 32 bit).
Advertisement
This is due to the fact that AngelScript doesn't support native calling conventions on AMD64, yet. Registered functions must thus use the generic calling convention.

The only sample (besides the feature tests) that works right out of the box on AMD64 is the tutorial sample (or at least it should work). I need to fix the other samples as well to work with both native calling conventions and the generic calling convention.

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

Thanks for pointing me in the right direction. With some tweaks I was able to make the tutorial app compile. Not well enough for a patch, but a few porting notes here:

You are using some windows specific headers:

#ifdef WIN32#include <conio.h>   // kbhit(), getch()#include <windows.h>#else#include <curses.h>   // kbhit(), getch()#include <time.h> // clock()#endif


I used clock in place of timeGetTime(). This was less than ideal because on my computer the clock value seems to have an actual resolution of 1/100 of a second, and it only counts cpu time actually used by the program. Time waiting for the console to do its output is not part of this. times() in <sys/time.h> may (or may not) be better.

#ifndef WIN32typedef int DWORD;DWORD timeGetTime() {        return (DWORD)((clock() * 1000) / CLOCKS_PER_SEC);}#endif


When compiling one must link with the curses library.

g++ main.cpp ../../../add_on/scriptstring/scriptstring.cpp -langelscript -lcurses


I had some problems with the script file itself. For some reason double slash comments seem not to be working on linux.

script (3, 14) : ERR  : Expected ';'script (6, 14) : ERR  : Expected ';'script (9, 11) : ERR  : Expected ';'Build() failed


Also I had some problems with the division inside this line:
Print("System has been running for " + GetSystemTime()/1000.0 + " seconds\n");


The function you're looking for is gettimeofday(). This is what games usually use for timing on linux and is supposed to have sub-millisecond precision on most platforms.

This topic is closed to new replies.

Advertisement