I have now a workaround for the Double/TDateTime result problem which works for me.
In X64.inc:
procedure x64call(
Address: Pointer;
out _RAX: IPointer;
_RCX, _RDX, _R8, _R9: IPointer;
var _XMM0: Double;
_XMM1, _XMM2, _XMM3: Double;
aStack: Pointer; aItems: IntPtr); assembler; {$IFDEF FPC}nostackframe;{$ENDIF}
_XMM0 is defined as var parameter and in the following statement
movsd xmm0,[_XMM0]
the register xmm0 is not correctly set with the value of _XMM0
I don’t know why this assignment goes wrong.
I changed the definition to
function x64call(
Address: Pointer;
out _RAX: IPointer;
_RCX, _RDX, _R8, _R9: IPointer;
_XMM0: Double;
_XMM1, _XMM2, _XMM3: Double;
aStack: Pointer; aItems: IntPtr): Double; assembler; {$IFDEF FPC}nostackframe;{$ENDIF}
the statement from
movsd xmm0,[_XMM0]
to
movsd xmm0,_XMM0
and on the nearly end of the function
movsd [_XMM0],xmm0
to
// movsd [_XMM0],xmm0
(the result type Double uses the xmm0 register so no assignment is needed)
And the two calls to x64call() must be changed from
x64call(Address, _RAX, _RCX, _RDX, _R8, _R9, _XMM0, _XMM1, _XMM2, _XMM3, pp, Length(Stack) div 8);
to
_XMM0 := x64call(Address, _RAX, _RCX, _RDX, _R8, _R9, _XMM0, _XMM1, _XMM2, _XMM3, pp, Length(Stack) div 8);