Reputation: 2612
I have two projects: a static library and a DLL that will link statically to this static library. Let's assume:
foo.lib (static library)
bar.dll (links against foo.lib)
foo.lib has the following function:
fooFile(...);
I successfully built the statically lib and dumpbin /symbols tells me that the function is there (although with some name mangling). When trying to link it against the bar.dll project, I get the following error:
error LNK2019: unresolved external symbol _fooFile referenced in function _fooSomething
Why is this failing? The same code works without issues in a Linux environment.
Upvotes: 0
Views: 33
Reputation: 52471
bar.dll project is compiled as C, or else includes foo.lib's headers under extern "C" {...}
. Essentially, one project exports the function as having C++ linkage, while the other tries to import it with C linkage.
Upvotes: 2