Hi. I use Urho3D game engine with AngelScript. But it segviolated on Android arm64-v8a. After some searches, I found that the reason was in the applied automatic wrapper for arm64, which does not work with "?&" parameters correctly. Therefore, I changed the void *asCGeneric::GetAddressOfArg(asUINT arg) function to this implementation:
// fix for wrap16.h return address of real arg, parametr ?& count as 2 arg.
int offset = 0;
for (asUINT n = 0, real = 0; real < sysFunction->parameterTypes.GetLength(); n++, real++) {
asCDataType* dt = &sysFunction->parameterTypes[real];
if (n == arg) {
if (!dt->IsReference() &&
dt->IsObject() &&
!dt->IsObjectHandle())
return *(void**) &stackPointer[offset];
// Get the address of the value
return &stackPointer[offset];
}
if (dt->GetTokenType() == ttQuestion) {
n++;
if (n == arg)
return &stackPointer[offset + AS_PTR_SIZE];
}
offset += dt->GetSizeOnStackDWords();
}
return 0;
After that, everything began to work correctly. But this only works for automatic wrapper and break the program in case of normal use.
Is it possible to add this code in engine as the "void *GetAddressOfRealArg(asUINT arg)" function and rewrite the wrapper to use it?