Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About stalker#3829

  • Rank

Personal Information

  • Interests

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. stalker#3829

    AngelScript 2.33.1: Bugs && Features

    Another confusion with multiple inheritance: baseOffset not applied to auxiliary object. Here's an example (stub): ... // C++ part class A { public: int SomeWorkA(int a) { printf("A::SomeWorkA | %lx | %i\n", this, aa); return a; } int aa = 33; }; class B { public: int SomeWorkB(int b) { printf("B::SomeWorkB | %lx | %i\n", this, bb); return b; } int bb = 44; }; class C: public A, public B { }; C* c = new C; // enough for the purpose of example c->SomeWorkA(0); // prints A::SomeWorkA | 5555d132e3e0 | 33 c->SomeWorkB(0); // prints B::SomeWorkB | 5555d132e3e4 | 44 #if 1 r = engine->RegisterGlobalFunction("int someWork(int)", asMETHODPR(C, SomeWorkB, (int), int), asCALL_THISCALL_ASGLOBAL, c); assert(r >= 0); #else r = engine->RegisterGlobalFunction("int someWork(int)", asMETHODPR(C, SomeWorkB, (int), int), asCALL_THISCALL_ASGLOBAL, (B*)c); assert(r >= 0); #endif ... // script part someWork(0); ... And the output: r = engine->RegisterGlobalFunction(..., c); A::SomeWorkA | 5555d132e3e0 | 33 B::SomeWorkB | 5555d132e3e4 | 44 calling someWork(0) from script: B::SomeWorkB | 5555d132e3e0 | 33 r = engine->RegisterGlobalFunction(..., (B*)c); A::SomeWorkA | 5555d1320350 | 33 B::SomeWorkB | 5555d1320354 | 44 calling someWork(0) from script: B::SomeWorkB | 5555d1320354 | 44 So for correct execution the class should be explicitly casted to the correct base one during global function registration, which was not clear to me and may be a bug (baseOffset not applied to auxiliary object). Sidenote: I've managed to setup AS+JIT+AATC. AATC uses reference counters through multiple inheritance. BlindMind's JIT also has bug with methods from multiple inheritance: doesn't apply baseOffset with gcc, but that's another topic.
  2. stalker#3829

    AngelScript 2.33.1: Bugs && Features

    Additional info/question. My pet project is an AI for Zero-K RTS game. Does anyone have successful experience with AS 2.33.1 + JIT (BlindMind's / bluecataudio's) + AATC (Angelscript addon Template Containers), any hints about how to setup/use collection of those tools (linux64+gcc preferably) and possible pitfalls? (by hints i think of "avoid noob-trap asMETHOD, use asMETHODPR", etc.)
  3. stalker#3829

    AngelScript 2.33.1: Bugs && Features

    Hi! Didn't found info how/where to report bugs, so going to share some findings on the forum. Btw what's the proper way to report bugs? I'm trying to use AngelScript in my pet project, for now getting familiar with AS. Using AngelScript 2.33.1 (50229f5 github commit), Linux x86-64, gcc 8.3.0. 1) AddressSanitizer: heap-buffer-overflow. (+-1 byte error) AddressSanitizer detects read of unallocated memory at line (strcmp compares null-terminated strings) The memory allocated here is not correct when "in_length = strlen(in_code);", strlen doesn't count null-char. Fix that works for me: code = asNEWARRAY(char, in_length + 1); if( code == 0 ) return asOUT_OF_MEMORY; memcpy(code, in_code, in_length); code[in_length] = '\0'; But if this part of AS works only with null-terminated strings than maybe strcpy (deals with null-char) should replace memcpy? 2) asMETHOD with method of a base class. asMETHOD doesn't detect ptrdiff_t for member function of base class, it's always 0. Workaround is to abuse asMETHODPR as much as possible. Attached online_gcc_8.cpp example (compatible with http://cpp.sh/) online_gcc_8.cpp
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!