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\lib\xmlparse.c(647): warning C4273: 'XML_ParserCreate' : inconsistent dll linkage
4> d:\src\gdcm\gdcm\utilities\gdcmexpat\lib\expat.h(206) : see previous definition of 'XML_ParserCreate'
The function call itself looks like:
XML_Parser XMLCALL
XML_ParserCreate(const XML_Char *encodingName)
{
return XML_ParserCreate_MM(encodingName, NULL, NULL);
}
where
#define XMLCALL __cdecl
and
XMLPARSEAPI(XML_Parser)
XML_ParserCreate(const XML_Char *encoding);
where
#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
and
#define XMLIMPORT __declspec(dllimport)
If I'm reading that properly, that means that the linkage is consistently __cdecl through XMLCALL-- right? Because, if so, then the warning is superfluous, or am I misinterpreting this?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With