[Top][All Lists]

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

[Chicken-users] Making an extension of various files

From: Pupeno
Subject: [Chicken-users] Making an extension of various files
Date: Sun, 6 Nov 2005 13:13:57 -0300
User-agent: KMail/1.8.3

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.os sc-mfl2.os `chicken-config -shared -libs`

and install it:

cp /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/ ...
#;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

Where's sc-mfl2-proc ? it was supoused to be there, on sc-mfl1. Well, maybe 
not, so I starting playing with the 'header' of sc-mfl2.scm and I tried:

(declare (unit sc-mfl1))
(declare (export sc-mfl2-proc))

it compiles, I can't access sc-mfl2-proc. Then I tried:

(define-extension sc-mfl1)
(declare (export sc-mfl2-proc))

it doesn't compile:

sc-mfl2.os: In function `C_toplevel':
sc-mfl2.c:(.text+0x27): multiple definition of `C_toplevel'
sc-mfl1.os:sc-mfl1.c:(.text+0x27): first defined here
collect2: ld returned 1 exit status

Then I tried:

(define-extension sc-mfl2)
(declare (export sc-mfl2-proc))

It doesn't compile either, same error. Then I tried:

(declare (export sc-mfl2-proc))

that is, no define-extension or unit. Same error!
And now I am out of ides, can anybody help me please ?
Thank you
Pupeno <address@hidden> (

Attachment: pgp1KZrpE8Q5w.pgp
Description: PGP signature

reply via email to

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