chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] FFI and shared libraries


From: Joel Reymont
Subject: Re: [Chicken-users] FFI and shared libraries
Date: Mon, 3 Jan 2005 09:34:32 +0000

> felix winkelmann wrote:

>Hm, I'm not exactly sure what you are doing here. If you use
>'(declare (uses ...))' for each compiled file, then the load-library
>should not be necessary. 

I think going the other way around does the trick for me, i.e. using
load-library but not (declare (uses ...).

>Couldn't you simply do this:
>compile every Scheme module into a unit (with a proper unit declaration, or
>the -unit compiler option), add -fPIC to the C compiler options (but
>don't compile them as -shared), and then link them together:

I'm using these rules in my make file:

%.o: %.scm 
        $(CHICKEN_CC) -e -c $<

%.o: %.cpp
        $(CHICKEN_CC) -c -e $<

%.so: $(OBJ) chango.scm
        $(CHICKEN_LD) -s -o $@ $^ 

chango.scm has a whole bunch of load-library statements and I then
require chango in my Scheme which loads chango.so. All the .o files are
units and I can (declare (use... )) them but only if they don't use FFI.
If I do then csi tries to load their scm file when I require chango. 

I can just do with load-library, is that correct? Will that execute the
unit's toplevel?

    Thanks, Joel

-- 
OpenPoker: The Linux of poker software
http://wagerlabs.com/forums
* Tenerife * Canary Islands * Spain





reply via email to

[Prev in Thread] Current Thread [Next in Thread]