Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FFI is slightly broken on FPC 3.0 #96

Closed
ollydev opened this issue Dec 23, 2016 · 4 comments
Closed

FFI is slightly broken on FPC 3.0 #96

ollydev opened this issue Dec 23, 2016 · 4 comments

Comments

@ollydev
Copy link
Collaborator

ollydev commented Dec 23, 2016

Here are the results of running the FFI tests (lazarus-1.6 branch) on FPC 3.0:

Win32:

  • CDECL - (38/38)

  • STDCALL - (38/38)

  • REGISTER - (38/38)

  • PASCAL - (30/38)

    • All individually pass, but will cause a crash (sigsegv) later on.
procedure Proc3(a: UInt8; b: Int64; c: UInt32; d: Int16; e: UInt16; f: Int32; g: UInt64; h: Int8)
procedure Proc9(a: TStatPackArr; b: TStrArr; constref c: TStatStrArr; d: TIntArr; e: TStatIntArr)
procedure Proc10(a: TShortRec; b: TPackRec; constref c: TStrRec; d: TLargeRec)
function Func2(const a, b, c: Int8): UInt8
function Func7(const a: Boolean): Boolean
function Func15(const a: TStatPackArr): TStatPackArr
function Func18(const a: TShortRec): TShortRec
function Func19(const a: TPackRec): TPackRec
function Func20(constref a: TStrRec): TStrRec

Win64:

  • DEFAULT - (37/38)
function Func6(const a: Currency): Currency

Linux64 (Ubuntu):

  • DEFAULT - (38/38)

Linux32:

  • Not supported we should probably warn or disable FFI usage?
@nielsAD
Copy link
Owner

nielsAD commented Jan 2, 2017

Thanks for looking into this. I think the win64 issues with Currency might be a FPC regression. According to their bugtracker, the issue will be fixed in the upcoming 3.0.2 release.

I'm afraid the pascal calling convention could be a libffi bug. I assume this line should also check for FFI_PASCAL. This is just a hunch, though.

@nielsAD
Copy link
Owner

nielsAD commented Feb 20, 2017

85a3c52 should have fixed the pascal calling convention issues. I haven't been able to test FPC 3.0.2 yet to see if it resolves the Currency issues.

@ollydev
Copy link
Collaborator Author

ollydev commented Jun 3, 2017

New issue:

Returning a string from C++ seems to fail using FFI, yet works using the native importing method.

https://villavu.com/forum/showthread.php?t=117233

@ghost
Copy link

ghost commented Nov 22, 2017

@Olly-, @nielsAD: All Win64 tests pass with Lazarus 1.8RC5 and FPC 3.0.4.

@nielsAD nielsAD closed this as completed Jun 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants