0

I'm trying to link my project with a DLL (let's call it A.DLL) and I'm getting the unresolved external symbol __imp__?func@@YA_JXZ. I "dumpbin /exports"ed the DLL and the lib and I saw only ?func@@YAJXZ.

So I would be very grateful if some1 could explain 1)why the difference in postfix in fund's decorated name 2) why is there no __imp__func name in the DLL nor in the Lib file for the dereferencing function?

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
Anorflame
  • 376
  • 3
  • 12
  • Normally the __imp__ should not be present in the DLL, only in the static import lib. And the reason name is different might be because it's not a function, it's a function pointer. – Medinoc Sep 18 '14 at 15:45
  • __imp__func also does not appear in lib. And it is a function declared in the header file. – Anorflame Sep 18 '14 at 15:57
  • 1
    Getting the `__imp_` export requires declaring the function with the `__declspec(dllexport)` attribute. Looks like this DLL was built with a .def file instead, it is not entirely uncommon. You avoid this error by fixing the declaration on the client code side and *not* declare it `__declspec(dllimport)`. All and all, something pretty wonky with the .h file you are using. We can't see it. – Hans Passant Sep 18 '14 at 16:14
  • I will try it, but the function is declared with declspec export/import macro. I just found out though that the dll was probably compiled in gnat, which means that probably mingw was used. It also may have consequences, no? – Anorflame Sep 18 '14 at 16:18

0 Answers0