chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Making an extension of various files


From: felix winkelmann
Subject: Re: [Chicken-users] Making an extension of various files
Date: Mon, 7 Nov 2005 06:53:25 +0100

On 11/6/05, Pupeno <address@hidden> wrote:
> How do I make an extension of two or more files ?
> I have sc-mfl1.scm containing:
>
> (define-extension sc-mfl1)
> (declare (export sc-mfl1-proc))
>
> (define (sc-mfl1-proc)
>   (display "Hello from sc-mfl1, the scons-chicken multiple-file-library 1."))
>
> and then I have sc-mfl2.scm, more or less like this (more about this latter):
>
> (declare (unit sc-mfl2))
> (declare (export sc-mfl2-proc))
>
> (define (sc-mfl2-proc)
>   (display "Hello from sc-mfl2, the scons-chicken multiple-file-library 2."))
>
> then I compile that to C source:
>
> chicken sc-mfl1.scm -output-file sc-mfl1.c -dynamic -feature
> chicken-compile-shared -feature compiling-extension
> chicken sc-mfl2.scm -output-file sc-mfl2.c -dynamic -feature
> chicken-compile-shared -feature compiling-extension
>
> and then I compile that to object code:
>
> gcc `chicken-config -shared -cflags` -c -o sc-mfl1.os sc-mfl1.c
> gcc `chicken-config -shared -cflags` -c -o sc-mfl2.os sc-mfl2.c
>
> and then I link it together:
>
> gcc -Wl,-R/usr/local//lib -Wl,-R/usr/local//lib -shared -o sc-mfl1.so
> sc-mfl1.os sc-mfl2.os `chicken-config -shared -libs`
>
> and install it:
>
> cp sc-mfl1.so /usr/local/lib/chicken/
> cp sc-mfl1.setup /usr/local/lib/chicken/
>
> then I use the extension:
>
> #;1> (use sc-mfl1)
> ; loading /usr/local//lib/chicken/sc-mfl1.so ...
> #;2> (sc-mfl1-proc)
> Hello from sc-mfl1, the scons-chicken multiple-file-library 1.
> #;3> (sc-mfl2-proc)
> Error: unbound variable: sc-mfl2-proc
> #;3>
>

I think, adding a

(declare (uses sc-mfl2))

in sc-mfl1.scm should work.


cheers,
felix


cheers,
felix




reply via email to

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