I found this thread much later and think I might have something to add.
I got similar output:
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEnd
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_GetBas
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetEle
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_Defaul
Expat.obj : error LNK2001: unresolved external symbol __imp_XML_SetSta
When I searched for one of the symbol in the libexpat.lib file, I found something interesting.
$ grep _imp__XML_SetCommentHandler libexpat.lib
Binary file libexpat.lib matches
$ grep __imp_XML_SetCommentHandler libexpat.lib
The short of it is that the symbol name is not correct. I think the toolchain (gcc, other VC version) used to build libexpat.lib was different from the toolchain that I am using to build XML::Parser::Expat and that is why the link is failing.
I have a theory on what is actually happening, but it is only a theory, so take it for what it is...
The libexpat.lib contains a XML_SetCommentHandler function that knows how to load the libexpat.dll and then call a differently named version of the function that resides in the DLL. This naming is the root problem.
When the libexpat.lib was compiled, the prototype of the DLL version of the function had extern "c", and some "declspec" keyword, added to the name. The use of extern "c" prepends a "_" to the symbol name. The use of "declspec" prepends a "_imp_" to the symbol name.
When the toolchain used to build libexpat.dll built the function, it honored the order of the extern "c" and "declspec" differently than the toolchain that I am using to build/link the libexpat.lib.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||