Clisp FFI 
Author Message
 Clisp FFI

I sent the following to the clist-list but thought I would see if I
could get some help here, too.

I'm having problems with attempting build my own FFI example based on
the example in the FFI implementation notes
< http://www.*-*-*.com/ ; and would appreciate any
help.




    call-f00f.lisp      f00f/  f00f-code.c  f00f-code.o




      i i i i i i i       ooooo    o        ooooooo   ooooo   ooooo
      I I I I I I I      8     8   8           8     8     o  8    8
      I  \ `+' /  I      8         8           8     8        8    8
       \  `-+-'  /       8         8           8      ooooo   8oooo
        `-__|__-'        8         8           8           8  8
            |            8     o   8           8     o     8  8
      ------+------       ooooo    8oooooo  ooo8ooo   ooooo   8

    Copyright (c) Bruno Haible, Michael Stoll 1992, 1993
    Copyright (c) Bruno Haible, Marcus Daniels 1994-1997
    Copyright (c) Bruno Haible, Pierpaolo Bernardi, Sam Steingold 1998
    Copyright (c) Bruno Haible, Sam Steingold 1999-2002

    Compiling file /home/kick/tmp/call-f00f.lisp ...
    WARNING:
    SETQ(FFI::*FOREIGN-LANGUAGE*): #<PACKAGE FFI> is locked
    Ignore the lock and proceed
    WARNING in (DEFAULT-FOREIGN-LANGUAGE :STDC)-4 in line 4 :
    SETQ: assignment to the internal special symbol FFI::*FOREIGN-LANGUAGE*

    Wrote file /home/kick/tmp/call-f00f.fas
    Wrote file /home/kick/tmp/call-f00f.c
    0 errors, 1 warning
    Bye.

    make: Warning: File `Makefile' has modification time 44 s in the future
    make: Nothing to be done for `clisp-module'.
    make: warning:  Clock skew detected.  Your build may be incomplete.
    /usr/test/npaero/local/sparc-sun-solaris2.6/bin/gcc -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -fomit-frame-pointer -Wno-sign-compare -O2 -fno-schedule-insns -fno-gcse -DUNIX_BINARY_DISTRIB -DUNICODE -DDYNAMIC_FFI -DNO_GETTEXT -DNO_SIGSEGV -I. -I/usr/test/awo/user_work/kick/sparc-sun-solaris2.6/lib/clisp/linkkit -c modules.c
    In file included from modules.d:11:
    /usr/test/awo/user_work/kick/sparc-sun-solaris2.6/lib/clisp/linkkit/clisp.h:2855: warning: call-clobbered register used for global register variable
    /usr/test/npaero/local/sparc-sun-solaris2.6/bin/gcc -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -fomit-frame-pointer -Wno-sign-compare -O2 -fno-schedule-insns -fno-gcse -DUNIX_BINARY_DISTRIB -DUNICODE -DDYNAMIC_FFI -DNO_GETTEXT -DNO_SIGSEGV -I. -x none modules.o f00f-code.o lisp.a libcharset.a libavcall.a libcallback.a -ltermcap -lnsl -lsocket -o lisp.run
    modules.o(.data+0x30): undefined reference to `module__f00f_code__subr_tab'
    modules.o(.data+0x34): undefined reference to `module__f00f_code__subr_tab_size'
    modules.o(.data+0x38): undefined reference to `module__f00f_code__object_tab'
    modules.o(.data+0x3c): undefined reference to `module__f00f_code__object_tab_size'
    modules.o(.data+0x44): undefined reference to `module__f00f_code__subr_tab_initdata'
    modules.o(.data+0x48): undefined reference to `module__f00f_code__object_tab_initdata'
    modules.o(.data+0x4c): undefined reference to `module__f00f_code__init_function_1'
    modules.o(.data+0x50): undefined reference to `module__f00f_code__init_function_2'
    collect2: ld returned 1 exit status

    base+f00f/   call-f00f.fas  call-f00f.lisp  f00f-code.c
    call-f00f.c  call-f00f.lib  f00f/       f00f-code.o

    #include <stdio.h>

    struct X { int i; };

    void f(struct X* p)
    {
        printf("p->i => %d\n", p->i);
    }

    (defpackage "CALL-F00F" (:use "LISP" "FFI"))
    (in-package "CALL-F00F")
    (def-c-struct X (i int))
    (default-foreign-language :stdc)
    (def-call-out f
        (:arguments (p (c-ptr X) :in :alloca))
      (:return-type nil))
    (defun call-f ()
      (f (make-X :i 5)))

    file_list=''
    mod_list=''
    if test -r f00f-code.c; then
      file_list="$file_list"' f00f-code.o'
      mod_list="$mod_list"' f00f_code'
    fi
    make clisp-module CC="${CC}" CFLAGS="${CFLAGS}" INCLUDES="$absolute_linkkitdir"
    NEW_FILES="$file_list"
    NEW_LIBS="$file_list"
    NEW_MODULES="$mod_list"
    TO_LOAD=''

    #include "clisp.h"

    extern object module__call_f00f__object_tab[];

    subr_t module__call_f00f__subr_tab[1];
    uintC module__call_f00f__subr_tab_size = 0;
    subr_initdata_t module__call_f00f__subr_tab_initdata[1];

    object module__call_f00f__object_tab[1];
    object_initdata_t module__call_f00f__object_tab_initdata[1];
    uintC module__call_f00f__object_tab_size = 0;

    extern void (f)();

    void module__call_f00f__init_function_1(module)
      var module_t* module;
    { }

    void module__call_f00f__init_function_2(module)
      var module_t* module;
    {
      register_foreign_function(&f,"f",1024);
    }

Why is "call-f00f.c" not being included in the build?



Sat, 23 Apr 2005 05:58:13 GMT  
 Clisp FFI

Quote:

> I'm having problems with attempting build my own FFI example [...]

I probably should've mentioned the following information in the first
post.


GNU CLISP 2.30 (released 2002-09-15) (built on login2 [10.17.192.178])
Features:
(CLOS LOOP COMPILER CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS
 GENERIC-STREAMS LOGICAL-PATHNAMES SCREEN FFI UNICODE BASE-CHAR=CHARACTER UNIX)

gcc (GCC) 3.1.1
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


SunOS login0 5.6 Generic_105181-29 sun4u sparc SUNW,Ultra-Enterprise Solaris



Sat, 23 Apr 2005 06:16:54 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Clisp FFI

2. CLISP FFI: C enumerations

3. CLISP FFI (win32)

4. FFI in CLISP for WIN32

5. Clisp and FFI's to C++

6. FFI Calls in clisp

7. FFI for CLISP: UDP sockets

8. FFI for Clisp on PPC (OS X and Fink)

9. wanted: Emacs integrated CLISP env for NT, *AND* mathematics package for CLISP

10. FFI survey for smalltalk

11. portable FFI representation

12. Calling Haskell function from C (FFI) causes seg-fault (GHC,linux)

 

 
Powered by phpBB® Forum Software