[Gambas-user] Get structure from extern function?

CJ lists at ...2828...
Sat Jul 12 14:53:05 CEST 2014


> 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.

Thanks for your suggestions, appreciated!

/CJ





More information about the User mailing list