Symbols defined multiple times in multi DLL project

Hi,
I'm trying to convert multiple projects in a Visual C++ 2005 solution from static libraries to DLLs.
I'm encountering a linking issue, and i'd need some help :

I have a DLL dll1.
A DLL dll2 uses dll1
A DLL dll3 uses dll1 and dll2.

In project dependency settings,
- dll2 depends on dll1
- dll3 depends on dll2 and dll1

My problem is that when i link dll2, i get errors about symbols in the import library of dll2 that are already defined in the import library of dll2

If i remove the dependency of dll1 for dll3, i get unresolved symbols from dll1. (i think dll2 only takes the symbols of dll1 it needs when it is linked, so the others symbols of dll1 used by dll3 can't be found.

I tried removing the automatic linking of library dependencies to try various link orders for dll3, but can't seem to find a way that works.

Do you have any ideas for potential solutions?
My problem is that when i link dll2, i get errors about symbols in the import library of dll2 that are already defined in the import library of dll2
Is this wat you really mean?

External symbols referenced in a Windows static lib files are not reported until the library is linked with an executable (I can't remember what happens if you link with a DLL). In that way, the reporting similar to the reporting that occurs on Unix with shared and static libraries.

External symbols references in a Windows DLL are reported at link time. This is different from the static library behaviour.

This means that you're likely to get extra link errors when linking a DLL that you don't see when you link the static lib. The DLL external references must be fully resolved.
I meant :My problem is that when i link dll3, i get errors about symbols in the import library of dll1 that are already defined in the import library of dll2

I'm aware that static libs are linked at executable link time and keep only referenced data, whild DLLs keep even unreferenced data, since they don't know what the EXE using the DLL will neeed to access.
This forced me to link other things in some DLLs, to resolve dependencies of symbols the DLL doesn't use.

My problem is the opposite, i get symbols defined multiple times in dll3, when dll3 tries to link dll1 symbols (with it's import library dll1.lib), it says me that a few symbols are already defined in the import library of dll2.lib (because when dll2 was built, it used the import library of dll1 too)
The multiple defined symbols are 4 class methods of 2 exported classes if that helps.
Is dll2 exporting those duplicate symbols?

Have you looked at dll1 and dll2 with depends to see what's actually imported/exported?
Somehow, VC was using an old .lib file of dll2 when it was still compiled as a static library, eventhough the project options and some code had been changed. So i had not really the problem i was describing.
I have yet to export some symbols from dll2 before it's DLL is ready, i'll come back in the thread if i have other issues
Also, if you make some mistake and somehow you don't export anything from your DLL, a .lib file won't be generated.

As an old manager used to say, "If it was easy, anyone would be able to do it."
Last edited on
Topic archived. No new replies allowed.