Page 1 of 1

SQLite (with external DLL) works only with 'double word' compiler alignment

Posted: Thu 04 Jul 2019 08:54
by Tarifer
Hello!

User-defined functions works only when I set Record field alignment option in 'Double word'. If I use Byte or Word, function call give AV error (Delphi, UniDac with source).

You should use implicit compiler directive in LiteCallUni.pas:

Code: Select all

{$A4}
or change record definition as:

Code: Select all

unit LiteCallUni;
...
  pFuncDef3250 = ^TFuncDef3250;
  TFuncDef3250 = packed record
    nArg: i8;             // Number of arguments.  -1 means unlimited */
    padding1: i8;
    padding2: i8;
    padding3: i8;
    funcFlags: u32;       // Some combination of SQLITE_FUNC_* */
    pUserData: IntPtr;    // User data parameter */
  end;
(see option "packed" in the record header, and padding1-padding3 in record definition).

Thank you.

Re: SQLite (with external DLL) works only with 'double word' compiler alignment

Posted: Thu 04 Jul 2019 13:19
by MaximG
Thank you for the information. We have reproduced the issue and will investigate its origin. We will inform you about the results shortly.

Re: SQLite (with external DLL) works only with 'double word' compiler alignment

Posted: Fri 19 Jul 2019 11:22
by MaximG
We've reproduced the issue and fixed it. The fix will be included in the new UniDAC build, which we're planning to release next week.