[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Shared libs for executables and interpreter
From: |
felix winkelmann |
Subject: |
Re: [Chicken-users] Shared libs for executables and interpreter |
Date: |
Mon, 6 Jun 2005 07:15:56 +0200 |
On 6/5/05, address@hidden <address@hidden> 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