On 6/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Is it possible to build a shared library that works from both the
> interpreter and a compiled "main" executables?
> 

If you omit the `unit' declaration, you can load a compiled dll
with `load' or `require'. This should work both in interpreted and
compiled code.
Adding a `unit' declaration will generate a renamed toplevel
procedure (there is no `main()'), which is intended to allow dynamic
linking. Files compiled with a `unit' declaration can also be
loaded dynamically, with the `load-library' procedure:

(load-library 'adder "adder.dll") ; possibly use full pathname here.

In the example you give, the dynamic loader attempts to find
the generic (non-unit) toplevel-procedure for adder, can't find
it and falls back by trying to load the file as source text.

You should just omit the declaration (unless you also want static
linking - in that case you have to compile two different modules).


cheers,
felix


_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to