I'm no expert in x64, so my assessment here may be wrong, but here's my analysis. Take a look at this screenshot:
(This is debugged remotely on an Ubuntu 16.04 machine via WinGDB in VS 2015.) The parameters of this function are incorrect (eg. ctx is actually pointing to 0x2000b520 instead of the object that the method was called with). I have marked the parameters in different colors, matching them with the memory view. The memory view is showing the "tempBuffer" memory passed to X64_CallFunction as the "args" param.
You can see that everything is ordered correctly, but there's an additional pointer at the start, which is a pointer to a glm::vec2 structure. (The contents happen to be the same as the "def" param, but I'm guessing that's a coincedence due to uninitialized memory?)
Looking through the code, I can see that "retPointer" is being set as the first pointer, so that must be its return address: (0x2000b520)
case ICC_CDECL_OBJFIRST_RETURNINMEM:
{
paramBuffer[0] = (asPWORD)retPointer;
paramBuffer[1] = (asPWORD)obj;
So as a result, the parameters in the GetVector2 function above are invalid.For the record, the method in the screenshot is registered like this:
r = m_engine->RegisterObjectMethod("WidgetLoadingContext", "vec2 GetVector2_extra(string name, bool required, vec2 def, int stuff)", asFUNCTION(GetVector2_extra), asCALL_CDECL_OBJFIRST);
I marked this as a bug, and I'm guessing it is a bug, but I'm not entirely sure, as I built AngelScript with a custom premake4 (actually GENie) script. (It works fine on Windows x86, though.)Any tips would be appreciated!