[Top][All Lists]

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

Re: [Chicken-users] creating shared libraries from two files chicken-bin

From: Felix
Subject: Re: [Chicken-users] creating shared libraries from two files chicken-bind / swig
Date: Thu, 16 Dec 2010 18:50:01 +0100 (CET)

From: David Dreisigmeyer <address@hidden>
Subject: [Chicken-users] creating shared libraries from two files chicken-bind 
/ swig
Date: Wed, 15 Dec 2010 14:58:55 -0500

> Hello,
> I've been trying to get the swig example with two modules to work, and
> wanted to compare that to using chicken-bind.  I did get it to work
> with swig, but I'm stuck when I use chicken-bind.  (I'm not sure if
> chicken bind is the best tool to use here.)  My code's below.

> For chicken-bind I can run:
>> chicken-bind example1_impl.c -o example1.scm
>> csc -sv example1.scm example1_impl.c
>> csi
> #;1> ,l 
> /Users/daviddreisigmeyer/Programming/scheme/chicken/swig/chicken-bind/
> ; loading 
> /Users/daviddreisigmeyer/Programming/scheme/chicken/swig/chicken-bind/
> ...
> #;1> (mymod 2 3)
> 2
> But if I try something like:
>> chicken-bind example1_impl.c -o example1.scm && chicken-bind example2_impl.c 
>> -o example2.scm
>> csc -cv example1.scm example1_impl.c -C -fPIC -C -c
>> csc -cv example2.scm example2_impl.c -C -fPIC -C -c
>> gcc -shared -o *.o
> ld: duplicate symbol _C_toplevel in example2.o and example1.o
> collect2: ld returned 1 exit status

You could try:

csc -sc example1.scm example1_impl.c -unit ex1 -o example1.o
csc -sc example2.scm example2_impl.c -unit ex2 -o example2.o

You can then link these together and use `load-library' to
load the different units or add a wrapper module (without -unit) that
does `(declare (uses ex1 ex2))'.

I recommend to forget about SWIG. The SWIG interface to CHICKEN is
more or less unmaintained. 


reply via email to

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