Advertisement

is AngelScript usable on x64

Started by October 14, 2008 01:17 PM
4 comments, last by WitchLord 16 years, 1 month ago
hi I need to integrate some scripting engine into my app (it is native x64 windows app) on 32bit target all is fine, angel script works as charm, but when compilled as x64 target (using vc2008 with sp1) there is a crash at asCContext::Release (the heap manager tells that block is corrupted) Is angel script usable in x64 environment ? or are there any known issues (expect that only GENERIC calls allowed, not the native ones) callstack of the crash: RayCaster.exe!_CrtIsValidHeapPointer(const void * pUserData=0x000000000dc6d4b0) Line 2103 C++ RayCaster.exe!_free_dbg_nolock(void * pUserData=0x000000000dc6d4b0, int nBlockUse=1) Line 1317 + 0xa bytes C++ RayCaster.exe!_free_dbg(void * pUserData=0x000000000dc6d4b0, int nBlockUse=1) Line 1258 + 0xe bytes C++ RayCaster.exe!free(void * pUserData=0x000000000dc6d4b0) Line 50 C++ > RayCaster.exe!asCContext::Release() Line 200 C++ RayCaster.exe!asCModule::CallInit() Line 193 C++ RayCaster.exe!asCModule::Build() Line 152 C++ RayCaster.exe!asCScriptEngine::Build(const char * module=0x0000000000000000) Line 499 + 0x10 bytes C++ RayCaster.exe!SceneCreate() Line 151 + 0x19 bytes C++ RayCaster.exe!wWinMain(HINSTANCE__ * hInstance=0x000000013f3d0000, HINSTANCE__ * hPrevInstance=0x0000000000000000, wchar_t * lpCmdLine=0x00000000003e49cc, int nCmdShow=1) Line 110 C++ RayCaster.exe!__tmainCRTStartup() Line 263 + 0x42 bytes C RayCaster.exe!wWinMainCRTStartup() Line 182 C BTW. The examples provided with AS crash in that same place when compilled as x64 apps, so this is not my app specific. Meybe the vc2008 have to do something with this ? (but sp1 fixed most of the compiller errors IMHO)
I wasn't aware of any problems on x64 until now. But then again, I don't have a 64bit platform to test it on.

I know others have at least tested the library on x64, and they didn't mention this problem, so it may be something that is compiler specific.

If you could help me determine the fix for this I'll update the SVN right away.

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

Advertisement
Ok, so i take a closer look at it tomorow :)

... ok, i could not sleep :)
so i'v debugged as a little and it turns out that 'AS_64BIT_PTR' was not defined
in as_config.h <lol>
vc2008 x64 target do not define __LP64__ nor __amd64__, soo AS_64BIT_PTR must be added as /D command line option or defined explicite in config

now all works like a charm :)
... and this heap corruption was from critical section that is defined as 6 bytes for 32bit and 10 bytes for x64 (btw. its dangerous to 'redeclare' CRITICAL_SECTION in AS, it really should be taken from windows.h)


[Edited by - wildmild on October 14, 2008 3:12:05 PM]
Can you tell me what flags the MSVC2008 compiler do define by default for x64? I need to update the as_config.h file so that AS_64BIT_PTR is declared automatically for this compiler.

Normally there is some verbose mode that outputs all the preprocessor flags.

Yes, I know about the danger of 'redeclaring' the types, though it is not something that changes a lot so it's not a big problem, and the advantage is bigger due to faster compile times when not having to include the windows.h header files.

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

For x86-64 MSVC defines the _M_X64 macro.
Thanks to both of you,

I'll add this to the as_config.h file so that this problem won't happen to others starting to use AngelScript.

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