Re: C structs and STk FFI (and Copyright problems ...)

From: Erick Gallesio <eg_at_unice.fr>
Date: Thu, 7 Jan 1999 09:58:23 +0100 (CET)

> > I've no implemented structures, because alignment problem make all the
> > stuff very complicated. For now, if you want to do such a call you
> > have two possibilities in such a case:
> > - use pointers in the C lib (just say that the object is a
> > void *). The problem is that if you don't have the source of the
> > library, you need to write a wrapper which transform a pointer to the
> > structure. In this case, this is probably more efficient to make
> > an ad-hoc interface and avoid the FFI extra cost.
>
> That is what I did. What is the extra cost involved with the FFI?
>

Oops didn't see that question.

You have a little penalty to pay when you use the FFI; Basically, the
actual version, which is completely written in C, place all the C
converted arguments in an array and when the last one is reached, do
effectively the call to the function. So the extra cost involved with
FFI is 1 read and 1 write array access for each argument.


                -- Erick
Received on Thu Jan 07 1999 - 10:07:57 CET

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST