[Distutils] Question about DOS/Windows static libs
Mon, 6 Mar 2000 21:34:04 -0500
> So: is this true? Does a static library under Windows need to be built
> with library and library search directories? Or is this an unnecessary
> appendage that can be jettisoned?
> AFAIK, Windows is just like Unix. You specify a list of libraries to
> use to find undefined symbols. In Unix you add "-lsomething" to the
> command line, and in
> Windows you add "something.lib" to a list.
No no, I'm talking about *building* a library, not about using one.
I.e. when you bundle *.obj together into foo.lib, do you need to tell
the tool-that-creates-foo.lib what libraries the code in *.obj depends
on and where to find those libraries?
Under Unix, it goes like this:
cc -c foo1.c foo2.c foo3.c # create *.o
ar -cr libfoo.a foo1.o foo2.o foo3.o
and with MSVC++'s command-line interface, I gather it's something
sorta-kinda-vaguely like this:
cl /c /Tcfoo1.c /Fofoo1.obj # repeat three times
link foo1.obj foo2.obj foo3.obj /OUT:foo.lib
HOWEVER, the code that does this in Distutils adds other libraries to
this mix. My question: is this necessary? Does the MSVC++ linker need
to know how to resolve symbols in *.obj *when it bundles them together
into a static library*?
If so, this affects the CCompiler interface; currently, MSVCCompiler and
UnixCCompiler are inconsistent, and I want to fix that. The question
is, do I add unused 'libraries' and 'library_dirs' args to the
UnixCCompiler link-a-static-lib method, or do I remove them from the
corresponding MSVCCompiler method?
Perry Stoll, author of the original code, seems to think that removing
the library options from MSVCCompiler's 'link_static_lib()' is OK, so
that's what I'm inclined to do. I just want to make sure I'm not
misunderstanding what it means to build a static library with MSVC++.
Greg Ward - Unix weenie email@example.com
BE ALERT!!!! (The world needs more lerts ...)