[Ecls-list] Important changes (+FFI) finally comitted

Goffioul Michael goffioul at imec.be
Wed Nov 24 01:57:39 UTC 2004


> * Goffioul Michael has contributed code that fixes and 
> completes ECL's 
> FFI including support for C structures and C/C++ variables, 
> among other 
> things. As some of you might remember, ECL implements its own port of 
> the UFFI specification. I have attached to this message a file with 
> examples from the UFFI that now compile and run under ECL. 
> Thanks Michael!!!

You're welcome. Although I'd like to point out that the current
FFI support is not complete, finished and stable. One of the main
conceptual problem I'm facing is how to interpret FFI types in
the form '(* typename). When trying to run actual UFFI examples,
I turned into problems.

For example in gettime example, one function is declared returning
(* (:struct tm)), but then the result is recasted to (:struct tm).
Other problems occur in the 2d-array example because you're loosing
the size information of the rows.

In the current code, objects of type '(* type) are kept/handled in
C code as :object, which is plain wrong because you cannot pass them
directly to C functions. However it had the advantage to keep the
size information problem mentionned above.
Somehow in UFFI, you should be able to deref an array element even
if the declared type is (:array :long), but this is not currently
possible with foreign-data type in ECL.

I have to admit that I'm a little bit confused about the "pointer"
type in UFFI (when do you mean a pointer, when do you mean the actual
value...), and I don't have much time to work on it.

Michael.

Note: I'm currently unable to produce any patch, as the anonymous CVS
on SF seems to be still down.




More information about the ecl-devel mailing list