How can I fix this vs10 inconsistent dll linkage warning?

前端 未结 1 507
傲寒
傲寒 2021-02-20 09:55

I have a series of warnings that I\'m trying to fix when building gdcm using visual studio 10 (32 bit version):

4>..\\..\\..\\..\\gdcm\\Utilities\\gdcmexpat\\         


        
1条回答
  •  情歌与酒
    2021-02-20 10:36

    No, it is complaining about __declspec(dllimport) missing from the function definition but present on the function declaration. You ought to take this seriously, it doesn't make sense to declare the function imported from a DLL but also present in your code. You can't have it both ways.

    This is usually caused by a missing #define. You edited down the macro definitions, I think, but when building the DLL you usually specify a macro in the build command (/D). So that the declaration of the function uses dllexport instead of dllimport. Which ensures that the function gets exported from the DLL. The client code uses the same .h file but is built without that macro defined. It sees the function declared as dllimport.

    Take a closer look at the XMLIMPORT macro definition, __declspec(dllexport) should be close. Another diagnostic is the set the exported functions, visible with Dumpbin.exe /exports. They should be missing if I guessed correctly.

    0 讨论(0)
提交回复
热议问题