chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] static library and link


From: Thomas Chust
Subject: Re: [Chicken-users] static library and link
Date: Tue, 23 May 2006 15:25:07 +0000 (GMT)

On Tue, 23 May 2006, Frédéric Peschanski wrote:

Thank you thomas for your insightful answer.
Sadly I tried again and now I have different but still
undefined symbols (only one in fact : C_pischeme_toplevel)

Hello Frédéric,

that surprises me a little. At least the top level of the explicitly linked library should be present... But let's see what we can do with your example code below, maybe that helps you more than crystal ball gazing for the build problem in a more complex project ;-)

[...] What I want to do is to compile a library (either shared or static, of course preferably shared) whose source code is in a bunch of .scm files, let's say R5RS-compliant code to start with.

I have a set of support files, e.g. supp1.scm, supp2.scm, ..., suppN.scm and a main library file, e.g. mylib.scm [...]

Probably there are missing links between the library files. I put the minimum of information because I would like to maintain some "inter-scheme" compatibility if possible. That's why I reserve a dedicated file for implementation-related infos (mylib.scm) [...]

Ok, you are hitting a small limitation of CHICKEN here. It is not easily possible to compile several seperate Scheme sources separately and then turn them into a single library unit. It is possible however to compile them all together into a single library unit or to compile each into a separate library unit and link them together in a shared or static library.

In the second case you have to take more care when loading the library, though, so I went for the first approach. For this I suggest that you either include the support files in the main library file using an (include "suppN.scm") statement, or that you use the approach taken by my Makefile.

I modified your example a little and added a Makefile that builds a statically and a dynamically linked program from the exact same sources. A gzipped tarball of the stuff is attached to this e-mail. I hope the commands in there are helpful for understanding and for getting your real project to build.

And don't hesitate to ask again if there are problems remaining :-)

cu,
Thomas

Attachment: myexample.tar.gz
Description: Modified example source with Makefile


reply via email to

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