www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Building library with more than one libraries built with the new -lib switch


the new -lib switch seems to insert these weird object-n (where n is any
number) to the libraries and it's causing conflicts if I build more than one

For me the multiple definitions error has always been for:

I don't know why it's even there. I don't think it's there if make my lib
without "dmd -lib" command.

For example: If I have group of independent d source that I build to a lib
A.lib (with the -lib switch) and then I have a separate group of d source that
I try to build to a lib called B.lib, but it partially depends on A.lib, so I
include a.lib in it. Now I get warnings about multiple module definitions. If I
build the B.lib without A.lib and then try to build C.lib with A.lib and B.lib
I get the same error and when I check the modules with librarian I see that
both have the same object-n module in it.
If I compile my sources in A.lib separately and then run librarian explicitly
to those files no object-n modules get generated and everything seems to work
(meaning my other libraries can be built).
Am I doing something wrong here? 
Or is the new -lib switch even supposed to be used to build more than one lib? 
Maybe it's a bug? 
Has anyone who knows linkers/librarians well tried this?

Jun 28 2008