unresolved symbols when linking against vc6 dll/lib

二次信任 提交于 2019-12-24 17:13:06

问题


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:


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!



来源:https://stackoverflow.com/questions/20585440/unresolved-symbols-when-linking-against-vc6-dll-lib

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!