Problem with DLL and Win64 lazarus / 72-DirectX ---------------------------------------------------------------------- SonnyBoyXXl · 2018-08-01 18:58 Hi folks, I have a problem with a Win64 Application - the same code works well in Win32, so I think it's an compiler issue. I work with CT 6.4 Calling the function GetSize from ID2D1Bitmap makes the problem the function is declared as Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ID2D1Bitmap = interface(ID2D1Image)        ['{a2296057-ea42-4099-983b-539fb6505426}']        function GetSize: TD2D1_SIZE_F; stdcall;         Calling the function the compiler makes the code: Quote# [56] lBitmapSize := lBitmap.GetSize();    movq   -48(%rbp),%rcx    movq   -48(%rbp),%rax    movq   (%rax),%rax    call   *32(%rax)    movq   %rax,-128(%rbp) the function crashes on the line as you see in the attached picture. The image itself is valid, could be drawn etc. but calling the get function fails. Also other functions like GetPixelSize fails. Could be the problem that the rcx register is assigned, and Windows request the rdx register ? How to solve this? best regards ---------------------------------------------------------------------- ASBzone · 2018-08-01 19:43 Are you calling the same DLL in the 32-bit application as in the 64-bit one? ---------------------------------------------------------------------- SonnyBoyXXl · 2018-08-01 21:45 Hi folks, I have now the answer. Finding this article https://forum.dlang.org/post/krxvtovytmjhnocyupah@forum.dlang.org and working a small example in VisualStudio it seems that M$ is not following the calling convention  for some COM routines So the working assembler routine is this one. The RDX register needs the adress of the return value too. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$asmmode intel}    asm        mov     rax ,  QWORD PTR [lBitmap]        mov   rax ,  QWORD PTR [rax]        lea     rdx ,  [lBitmapSize]        mov   rcx ,  QWORD PTR [lBitmap]        call    QWORD PTR [rax+32] // GetSize is first function        mov     rax , qword ptr [rax]        mov     qword ptr [lBitmapSize],rax    end;    {$ENDIF}  I'm not sure if this is a "always working" way. Some gurus should look at this topic. I will place a bug issue in the bug tracker. Best regards. ---------------------------------------------------------------------- marcov · 2018-08-02 10:38 Please file a bug, and quote that URL. Thank you.