0
votes

Say I have A.lib and B.dll (with its own B.lib) that are really the same thing (they share headers and symbols).

I need an application to link with both of them, but I only want to do this through A.lib. Basically, I need the linker to be able to find the symbols exported from B.dll without having to explicitly link with B.lib.

Ideally, I would like to eliminate A.lib altogether and have some code in B.lib and the rest in B.dll.

Edit

My objective is to create a library that can work directly with certain specially-named symbols in applications that link with it, without forcing library users to supply pointers to them. Said symbols (mostly functions) are tool-generated, and so they generally lack any descriptive value in their names (not to mention they're quite numerous).

1

1 Answers

2
votes

You can add a static library project to your solution, say C. With only A.lib and B.lib as additional dependencies, no code. Which runs lib.exe and merges A.lib and B.lib into C.lib. Which any subsequent project can link to.

Well, that should work as long as you monkey with project dependencies to ensure that everything is built in the right order. The C project depends on A and B, everything that uses C.lib depends on C. Hiding dependencies like this isn't the greatest practice.