I am in VS2003, building C++ .dll libraries.
I want to create a single .dll that combines its own code with code from
other dlls. For example, I want to build B.dll, where B has its own source
code, and also refers to routines in A.dll. I have another app C.exe that
will link to B.dll (and/or A.dll).
Clearly there is a dependency: B depends on A.
I can build and link A.dll just fine on its own. But when I try to build
B.dll, I get problems.
The first problem was that when I tried to build B.dll on its own, the
routines in A that B wants were not there, so I got a slew of LNK2001 and
LNK2019 (unresolved external symbol) errors, for all the routines in A that
are referred to in B.
My attempt to fix this was to set A.dll as input to the linker in B, in
Additional Dependencies. However, when I do this, it fails with LNK1136
(invalid or corrupt file), presumably because I am linking in a .dll, not a
.lib
There is no A.lib, and I don't know where else the linker for B can find the
routines in A that it needs.
What can I do to fix this?
Thanks
Martin Richter [MVP] - 15 Jul 2005 09:22 GMT
Hallo Michael L!
> I want to create a single .dll that combines its own code with code from
> other dlls. For example, I want to build B.dll, where B has its own source
[quoted text clipped - 20 lines]
>
> What can I do to fix this?
There must be a LIB file for A. Otherwies force creation of it. Include
this as an input file for B.
Usually if I have constructs like this I just create a great solution
hat include EXE and DLL's then I define dependiencies and usually this
is enough.

Signature
Martin Richter [MVP] WWJD
"In C we had to code our own bugs. In C++ we can inherit them."
FAQ : http://www.mpdvc.de
Samples: http://www.codeguru.com http://www.codeproject.com
Michael L - 15 Jul 2005 16:35 GMT
> There must be a LIB file for A. Otherwies force creation of it. Include
> this as an input file for B.
> Usually if I have constructs like this I just create a great solution
> hat include EXE and DLL's then I define dependiencies and usually this
> is enough.
Thanks, Martin. That starts to make sense.
Is there a way to tell it to build both a .lib and a .dll for A at the same
time, or do I have to choose only one that is built at a time?
Thanks, Michael
Martin Richter [MVP] - 16 Jul 2005 13:15 GMT
Hallo Michael L!
> Thanks, Martin. That starts to make sense.
>
> Is there a way to tell it to build both a .lib and a .dll for A at the same
> time, or do I have to choose only one that is built at a time?
Usually lib and dll are produced at the same time. The default project
settings ofthe linker are adjusted in tis way. Look into the linker
properties.

Signature
Martin Richter [MVP] WWJD
"In C we had to code our own bugs. In C++ we can inherit them."
FAQ : http://www.mpdvc.de
Samples: http://www.codeguru.com http://www.codeproject.com