Le 11/07/2014 15:33, CJ a écrit :
>
> Attached is a new bt after updating to latest Free Pascal version 2.6.4. I
> also
> tested returning a simple string and that works OK just like integer.
>
> Shared library was compiled with {$OPTIMIZATION OFF} and {$DEBUGINFO ON}
> switches
> and hopefully it may give some new clues? Are there any other tests I can
> run that
> may reveal helpfull information?
>
> PS: Free Pascal source code included just for reference.
>
> /CJ
>

Maybe libffi does not support Pascal, or Pascal does not correctly 
implements "cdecl". Because even if you use the "cdecl" keyword, 
apparently LIBVERSION expects one argument, whereas logically it should 
take no arguments, and returns a pointer to the returned structure.

Here is what I suggest:

1) Search the FreePascal documentation to know how exactly arguments are 
passed to functions, and how "cdecl" is implemented.

2) Check that the way you declare your function ensures that LIBVersion 
returns a pointer to the structure, or not a copy of the structure - 
This is what the argument name "result" tells us.

3) If you can't return a pointer, transform the declaration of the 
extern function in Gambas, so that the function takes one argument which 
is a structure matching the Pascal structure.

Regards,

-- 
Benoît Minisini

------------------------------------------------------------------------------
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to