[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: |
David Dreisigmeyer |
Subject: |
Re: [Chicken-users] creating shared libraries from two files chicken-bind / swig |
Date: |
Mon, 20 Dec 2010 11:01:08 -0500 |
This doesn't seem to work:
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 haven't had time to try out other things, but any other suggestions
would be welcome.
On Thu, Dec 16, 2010 at 12:50 PM, Felix
<address@hidden> wrote:
> 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/example1.so
>> ; loading
>> /Users/daviddreisigmeyer/Programming/scheme/chicken/swig/chicken-bind/example1.so
>> ...
>> #;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 examples.so *.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.
>
>
> cheers,
> felix
>