views:

64

answers:

1

Hello again gurus, I have compiled some external C++ code into a dll, thirdpartycode.dll, using Visual Studio 2008. The code is wrapped in extern "C".

Since I am cross compiling, creating a 64 bit dll on my 32 bit machine; I am using x64 as "Active solution platform" in the "Configuration Manager".

My thirdpartycode.dll compiles and links successfully. Next I want to create another dll containing code that calls the thirdpartycode.dll: wrapper.dll. As the name indicates it is a wrapper simplifying certain calls to a complex API inside thirdpartycode.dll. I then plan to call wrapper.dll from a C# program.

My problem however is that when I try to link my wrapper.dll, I get unresolved symbols :-(. For each function in thirdpartycode.dll, e.g. "func1"; I get an unresolved external symbol "__imp_func1". Using Dependency Walker I verify that thirdpartycode.dll indeeed does export "func1".

I DO list thirdpartycode.lib in "Additional dependencies". I have turned on /VERBOSE and can see that thirdpartycode.lib is searched.

If I repeat this whole process but using x86 as "Active solution platform" things works just fine!?

Any ideas what is going wrong?

Where does the _imp prefix come from? It is a bit confusing, since for troubleshooting I would compare exported symbols from thirdpartycode.dll using Dependency Walker with needed symbols from wrapper.obj using dumpbin.

Thanks in advance for any answers!

A: 

Just to verify, when you added the thirdpartycode.lib to the "Additional Dependencies" you made sure to include the path to the libs location correct? Under the "additional library directories" portion of Linker->General.

Also, if the projects are in the same solution, are you making sure that your build order is such that the thirdpartycode project is building before your code?

JMcCarty
Yes and yes. Also from the output from the linker using /VERBOSE I can see that thirdpartycode.lib is searched.
Andreas Werner Paulsen
Thanks for your suggestions JMcCarty, but I think there must be something else going wrong.
Andreas Werner Paulsen