unresolved symbols when linking against vc6 dll/lib

955 views Asked by At

I'm using vs2012 to create a small wrapper dll, linking against another dll (.lib) which was built with VC6.

I get link errors like:

error LNK2019: unresolved external symbol __imp__functionName@8

I added the lib file supplied with the vc6 dll to the link line, as I've done in the past... is there some version problem here? The vc6 dll header file declares the functions in what I think is the standard way:

#define DLLIMPORT extern "C" __declspec(dllimport)
DLLIMPORT ULONG WINAPI functionName(...);

Using dumpbin /exports on the vc6 lib file shows "functionName" without the imp prefix and "@8".. not sure if that's a problem or just dumpbin being nice and demangling for me.

I'm not a windows person and have no idea why the linker isn't finding the symbols...help!

1

There are 1 answers

3
Tyler Daniel On

Solved! There were two problems:

1) dumpbin /exports doesn't show all of the symbols. Using /all instead shows symbols of the form __imp_functionName@8.

2) the linker was looking for symbols of the form __imp__ not __imp_ as provided by the vc6 lib. google tells me that this is the difference between 32-bit and 64-bit builds, so the vc6 library was a 64 bit build while mine was 32.

Changing my wrapper dll to 64-bit solved the problem!

That was half a day well spent! Maybe. Probably... not. It's times like these when I love being a programmer!