Is it possible to build a shared library that works from both the 
interpreter and a compiled "main" executables?

If I have a file like this:

        (declare (unit adder))

        (define (add x y)
                (+ x y))


I have to remove the "declare" to get it to load into the interpreter 
without error, and I have to add it to use the unit as a shared library 
from a Chicken executable.

I'm using 1.89 on Windows, and I'm compiling the library with the -dll 
switch like this:

        adder.dll: adder.scm
                csc adder.scm -dll

The executable that uses the library looks like this:

        (require-extension adder)

        (print (add 2.0 2.0))

The error I get in the interpreter if the declare is present looks like 
this:

#;1> (require-extension adder)
; loading .\adder.dll ...
Error: unbound variable: |MZ\É\ \♥\ \ \ \♦\ \ \ \ \ \ \ \╕\ \ \ \ \ \ \ 
@\ 
\ \ \
 \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \α\ \ \ 
\♫\▼\║\♫\
 \┤|
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to