[plt-scheme] libc and the FFI

From: Jim Meier (jim at dsdd.org)
Date: Wed May 30 15:43:52 EDT 2007

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



Posted on the users mailing list.