Ah, I tried adding these at the top of the bindings in unit plutovg_api;
{$if defined(CPU32)}{$CALLING cdecl}{$ifend}
{$Packrecords C}
like this:
unit plutovg_api;
interface
{$if defined(CPU32)}{$CALLING cdecl}{$ifend}
{$Packrecords C}
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
but I still get that error.
Looks like it is using cdecl; external PLUTOVG_LIB;
I am running Win 10 64 bit CPU, but compiling with 32 bit Lazarus 2.2.4 FPC 3.2.2 i386-win32
With the 64Bit version, I needed to keep the folder structure for it to work.
I tried the same folder structure for 32 Bit compilation (and the added switches) but still cannot get rid of the error.
Access violation at Address 64D15631 ($3F80000C)
64D15631 D9400C fld dword ptr [eax+$0C]
64D15634 D905A4C2D364 fld dword ptr [$64D3C2A4]
64D1563A DEC9 fmullp st(1),st(0)
64D1563C D91C24 fstp dword ptr [esp]
64D1563F E8EC290200 call +$000229EC
64D15644 8945F4 mov [ebp-$0C],eax
64D15647 8B4508 mov eax,[ebp+$08]
64D1564A D900 fld dword ptr [eax]
64D1564C D905A4C2D364 fld dword ptr [$64D3C2A4]
64D15652 DEC9 fmullp st(1),st(0)
64D15654 D91C24 fstp dword ptr [esp]
64D15657 E8D4290200 call +$000229D4
64D1565C 8945F0 mov [ebp-$10],eax
64D1565F 8B4508 mov eax,[ebp+$08]
64D15662 D94004 fld dword ptr [eax+$04]
fld dword ptr [eax+$0C]) is the FPU trying to load a Single from an invalid pointer.
Assigning @PLUTOVG_IDENTITY_MATRIX to a variable of the wrong type (record vs pointer)
or
passing an uninitialized/incorrect pointer possibly causes the problem?
Currently have in unit plutovg_api;:
// 2D Transformation Matrix
plutovg_matrix_t = ^plutovg_matrix;
plutovg_matrix = record
a: single;
b: single;
c: single;
d: single;
e: single;
f: single;
end;