[gambit-list] static lib question

REPLeffect repleffect at gmail.com
Fri Feb 3 12:40:39 EST 2012


[snip]

> I'm considering adding a new compiler flag "-lib" to create libraries.  This would combine the "gsc -link", the "gsc -obj" and MAKE_LIB into one command:
>
>    gsc -lib -o lib1.a lib1-a.scm lib1-b.c
>
> I'm not sure however how to get this to work with separate compilation, because the .c files are required for the Scheme-level link, and the .o files are required for the C-level link, and it would be unfortunate to recompile the .c files every time the library is created.
>
> Marc
>

It is probably just a matter of personal taste, but I actually prefer
doing the individual steps separately.  I generally don't go straight
from a .scm file to an object file or an executable.  I write my
makefiles to generate the C files from the .scm files, then generate
the link file(s), then compile the C files to .o files, then
separately link the .o files into an executable.  But that's just me.

In the case of the -lib flag, couldn't you have -keep-c turned on by
default whenever -lib is used (and then only rebuild the *.scm file
when the *.c file isn't up-to-date)?  Then you could add a -no-keep-c
flag, or whatever you wish to call it, for any masochist who wishes to
rebuild every time :-D.  Of course, I'm probably going to continue to
do my builds explicitly in separate steps, so perhaps I'm not the
right person to ask how it should work.



More information about the Gambit-list mailing list