[plt-scheme] libc and the FFI

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed May 30 17:47:23 EDT 2007

At Wed, 30 May 2007 21:48:27 +0200, Hans Oesterholt-Dijkema wrote:
> Does that work on windoze?

Yes.

(You're right to be suspicious, because shared-library symbol lookup
works differently under Windows. But we were able to make `ffi-lib' and
`get-ffi-obj' behave more the same.)

Matthew

> Jim Meier schreef:
> > You can load the "current" program symbol table with ffi by giving #f 
> > as the library name:
> >
> >   (define libc (ffi-lib #f))
> >
> > So to grab the abort() function, for example,
> >
> >   (define  abort (get-ffi-obj "abort" libc (_fun -> _void))
> >
> > Good Luck,
> > -J
> >
> > On 30-May-07, at 1:31 PM, Hans Oesterholt-Dijkema wrote:
> >
> >> Dear All,
> >>
> >> If I need some function from libc, how can I
> >> load the right library with ffi-lib?
> >>
> >> /usr/lib/libc.so tends to be some LD script:
> >>
> >> e.g. (for a recent debian installation)
> >>
> >> /* GNU ld script
> >>   Use the shared library, but some functions are only in
> >>   the static library, so try that secondarily.  */
> >> OUTPUT_FORMAT(elf32-i386)
> >> GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a )
> >>
> >> What to do?
> >>
> >> --Hans
> >>
> >>
> >>
> >>
> >> _________________________________________________
> >>  For list-related administrative tasks:
> >>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> >
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.