From: Deep
Subject: Request for FFI howto
Date: 
Message-ID: <1123824912.643398.125680@g14g2000cwa.googlegroups.com>
Could someone point out a concise howto for generating FFI for C code.
I have looked at swig. Writing interface files for all the C code seems
daunting. I am using sbcl and cmucl on debian.

From: joesb
Subject: Re: Request for FFI howto
Date: 
Message-ID: <1123954487.135556.323000@g44g2000cwa.googlegroups.com>
Deep เขียน:
> Could someone point out a concise howto for generating FFI for C code.
> I have looked at swig. Writing interface files for all the C code seems
> daunting. I am using sbcl and cmucl on debian.

There is new project call Fetter FFI.


I use AH2CL, It's very simple so it can't handle #define, default
parameter. But It's not hard writing some script to massage Header file
to a clean one before feeding that to AH2CL.
(I also have my own patch on it for handling typedef, and defining
object pointer as void pointer)


My wish list would be a program that read SWIG XML output or SWIG SEXP
output and turn it to CFFI or UFFI.
From: Surendra Singhi
Subject: Re: Request for FFI howto
Date: 
Message-ID: <y875y2oa.fsf@netscape.net>
"joesb" <··········@gmail.com> writes:

> Deep เขียน:
>> Could someone point out a concise howto for generating FFI for C code.
>> I have looked at swig. Writing interface files for all the C code seems
>> daunting. I am using sbcl and cmucl on debian.
>

SWIG cvs version, currently supports Clisp, Allegro and UFFI.
No sbcl or cmucl :(


> My wish list would be a program that read SWIG XML output or SWIG SEXP
> output and turn it to CFFI or UFFI.
Why XML output or SEXP, SWIG will directly turn it to UFFI.


-- 
Surendra Singhi
http://www.public.asu.edu/~sksinghi/index.html

"War is Peace! Freedom is Slavery! Ignorance is Strength!"
    - Orwell, 1984, 1948
From: joesb
Subject: Re: Request for FFI howto
Date: 
Message-ID: <1124250230.334922.76620@z14g2000cwz.googlegroups.com>
Surendra Singhi wrote:
> "joesb" <··········@gmail.com> writes:
>
> > Deep เขียน:
> >> Could someone point out a concise howto for generating FFI for C code.
> >> I have looked at swig. Writing interface files for all the C code seems
> >> daunting. I am using sbcl and cmucl on debian.
> >
>
> SWIG cvs version, currently supports Clisp, Allegro and UFFI.
> No sbcl or cmucl :(
>
>
> > My wish list would be a program that read SWIG XML output or SWIG SEXP
> > output and turn it to CFFI or UFFI.
> Why XML output or SEXP, SWIG will directly turn it to UFFI.
>

Because I may not want to use UFFI :)
I want to use C-FFI, it support Callback.
I may want to use other library, if I need to.

In short, I want a program that turn SWIG's XML or SEXP output in to a
live definition database. So that I could, later on, query about
typename, type definition, function definition, etc. Every things SWIG
know. So that if I ever needed to generate lisp code, based on those
definition, I could.

If such program is available, someone could have create a simple
SBCL-FFI or CMUCL-FFI generator in short time, and all code in Lisp, in
considerable time, without having to code in C++, isn't that good?

If it's output is already in UFFI, then I could never have the
information that UFFI doesn't need.

Does this makes sense?

I wonder if this such project is already started.
It seems that Fetter use GCC-XML approach, which might be better.

>
> --
> Surendra Singhi
> http://www.public.asu.edu/~sksinghi/index.html
>
> "War is Peace! Freedom is Slavery! Ignorance is Strength!"
>     - Orwell, 1984, 1948
From: ·······@gmail.com
Subject: Re: Request for FFI howto
Date: 
Message-ID: <1125046911.222999.279080@g44g2000cwa.googlegroups.com>
> In short, I want a program that turn SWIG's XML or SEXP output in to a
> live definition database. So that I could, later on, query about
> typename, type definition, function definition, etc.

GCC-XML is a far better tool for generating such a database. Actually,
Verrazano's (AKA Fetter) IR is basically such a database. Serializing
the IR for use at runtime is definitely on my list of post Sept. 1
features to add to Verrazano. Since you seem to have a need: what kind
of database format were you thinking about?