|
From: Julien L. <ju...@fa...> - 2006-03-22 13:10:17
|
On 20/03/2006 14:45, Michael Gerdau quoted Marcio Hermes: >> I want to suggest a naming rule for gcc libraries: >> >> static library -> libNAME.a >> dynamic library -> libNAME.dll.a >> >> where: >> - static library is an archive with a set of routines/functions. >> - dynamic library will link routine/function calls to NAME.dll file. >> >> a bad example: >> -libopengl32.a will link to opengl32.dll and have a static library name. > > Just for me to understand what you mean: > When you write 'dynamic library' you actually mean 'import library' I support this idea of having static libraries '.a' and import libraries as '.dll.a' My system is currently set up this way, and I haven't had issues with it. > And while I'm at it: > What is the rationale behind this proposal ? First, developper friendliness, by looking at an extension, we know right away if it's an import library or a static library. Geeks like me assign different icons to each extension ;-) Also, this doesn't affect gcc's linking order, it inforces the difference between static and shared, and actually gives more priority to linking with a import library. Examples of search orders (`gcc -Wl,--verbose foo.c') gcc.exe (GCC) 3.4.5 (mingw special): - libfoo.dll.a - foo.dll.a - libfoo.a - libfoo.dll - foo.dll - libfoo.a (duplicate, shouldn't this be 'foo.a' ???) Because of this, we can ensure that the program will be linked against a dll if using -lfoo.dll: - libfoo.dll.dll.a - foo.dll.dll.a - libfoo.dll.a (the one we want) - libfoo.dll.dll - foo.dll.dll The naming of .dll.a and .a is also a convention that is respected by more and more packages because of the use of libtool in such packages. When creating dlls, libtool places the dll in /bin, and creates '.dll.a', '.a' and '.la' in /lib Even if we're not to use libtool for w32api and mingw-runtime; we could respect libtool's defaults in naming. The only caveat I found is that the specs file needs to be reviewed if using `gcc -Wl,-dn' or `gcc -Wl,-dy' (ie, linking only to static/shared libraries) The fix is simple: change every occurance of -lfoo to -lfoo.dll if the library had been renamed (eg: libkernel.a to libkernel.dll.a) Julien |