Build Mini-XML DLL with Visual Studio Command Prompt

 Mini-XML is an excellent API to generate and parse XML. Its web site is: http://www.msweet.org/projects.php?Z3. It was writtenin C language. Although there is a Visual Studioproject file in the "vcnet" subdirectory of Mini-XML 2.10 to build the library,the projectis a bit old and not suitable for varIoUs Visual Studio versions.Command prompt is an alternative choice tobuild the library on Windows platform. The static library of Mini-XML on Windows is NOT thread-safe. So only dynamic library is considered here. The following commands can be used to build Mini-XML 2.10 DLL (Don't start immediately. Don'tforget toread the notes below the commands):
------------------------------------------------------
1. build 32-bit debug version DLL:
vcvarsall x86
cl /c /D "WIN32" /Gd /MDd /nologo /Zi mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c
link /DEF:mxml1.def /DLL /DEBUG /IMPLIB:mxml_x86d.lib /MACHINE:X86 /NOlogo /OUT:mxml_x86d.dll /PDB:mxml_x86d.pdb /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x86d.dll and mxml_x86d.lib are built.
------------------------------------------------------
2. build 32-bit release version DLL:
vcvarsall x86
cl /c /D "WIN32" /Gd /MD /nologo mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c
link /DEF:mxml1.def /DLL /IMPLIB:mxml_x86.lib /MACHINE:X86 /NOlogo /OUT:mxml_x86.dll /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x86.dll and mxml_x86.lib are built.
------------------------------------------------------
3. build 64-bit debug version DLL:
vcvarsall x64
cl /c /D "WIN32" /Gd /MDd /nologo /Zi mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c
link /DEF:mxml1.def /DLL /DEBUG /IMPLIB:mxml_x64d.lib /MACHINE:X64 /NOlogo /OUT:mxml_x64d.dll /PDB:mxml_x64d.pdb /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x64d.dll and mxml_x64d.lib are built. Here in the command /D "WIN32" must be used. You cannot use /D "WIN64".The reason is : the following macro is defined in "mxml-file.c":
#ifndef WIN32
#  include <unistd.h>
#endif /* !WIN32 */
#include "mxml-private.h"
If /D "WIN64" is used,the header file "mxml-private.h" will not be included. The compiler cannot find "unistd.h" on Windows platform. It wiil report an error.
------------------------------------------------------
4. build 64-bit release version DLL:
vcvarsall x64
cl /c /D "WIN32" /Gd /MD /nologo mxml-attr.c mxml-entity.c mxml-file.c mxml-get.c mxml-index.c mxml-node.c mxml-private.c mxml-search.c mxml-set.c mxml-string.c
link /DEF:mxml1.def /DLL /IMPLIB:mxml_x64.lib /MACHINE:X64 /NOlogo /OUT:mxml_x64.dll /VERSION:2.10 /VERBOSE mxml-attr.obj mxml-entity.obj mxml-file.obj mxml-get.obj mxml-index.obj mxml-node.obj mxml-private.obj mxml-search.obj mxml-set.obj mxml-string.obj
Result: mxml_x64.dll and mxml_x64.lib are built. Here in the command /D "WIN32" must be used. You cannot use /D "WIN64".The reason is the same as stated above.
------------------------------------------------------
Note:
1. "vcvarsall" is a .BAT file included in all versions of Visual Studio. In VS 2010,it is in the folder "\Microsoft Visual Studio 10.0\VC\ ".
2. "config.h" and "mxml1.def" are in the "vcnet" subdirectory. Users need to copy the two file to the folder including C source code files of mini-XML. "mxml1.def" must be modified as follows:
delete the first line: LIBRARY "mxml1"
Now the content of the"mxml1.def" should be:
EXPORTS
 _mxml_strdupf
 _mxml_vstrdupf
 mxml_ignore_cb
 mxml_integer_cb
 mxml_opaque_cb
 mxml_real_cb
 mxmlAdd
 mxmlDelete
 mxmlElementDeleteAttr
 mxmlElementGetAttr
 mxmlElementSetAttr
 mxmlElementSetAttrf
 mxmlEntityAddCallback
 mxmlEntityGetName
 mxmlEntityGetValue
 mxmlEntityRemoveCallback
 mxmlFindElement
 mxmlFindpath
 mxmlGetCDATA
 mxmlGetCustom
 mxmlGetElement
 mxmlGetFirstChild
 mxmlGetInteger
 mxmlGetLastChild
 mxmlGetNextSibling
 mxmlGetopaque
 mxmlGetParent
 mxmlGetPrevSibling
 mxmlGetReal
 mxmlGetRefCount
 mxmlGetText
 mxmlGetType
 mxmlGetUserData
 mxmlIndexDelete
 mxmlIndexEnum
 mxmlIndexFind
 mxmlIndexGetCount
 mxmlIndexNew
 mxmlIndexReset
 mxmlLoadFd
 mxmlLoadFile
 mxmlLoadString
 mxmlNewCDATA
 mxmlNewCustom
 mxmlNewElement
 mxmlNewInteger
 mxmlNewOpaque
 mxmlNewReal
 mxmlNewText
 mxmlNewTextf
 mxmlNewXML
 mxmlRelease
 mxmlRemove
 mxmlRetain
 mxmlSaveAllocString
 mxmlSaveFd
 mxmlSaveFile
 mxmlSaveString
 mxmlSAXLoadFd
 mxmlSAXLoadFile
 mxmlSAXLoadString
 mxmlSetCDATA
 mxmlSetCustom
 mxmlSetCustomHandlers
 mxmlSetElement
 mxmlSetErrorCallback
 mxmlSetInteger
 mxmlSetopaque
 mxmlSetReal
 mxmlSetText
 mxmlSetTextf
 mxmlSetUserData
 mxmlSetWrapMargin
 mxmlWalkNext
 mxmlWalkPrev
3. "_x86" suffix is added to the names of 32-bit LIB and DLL files,and "_x64" suffix is added to the names of the 64-bit LIB and DLL files.
4. "d" suffix is added to the names of the debug version LIB and DLL files.
5. The command prompt method can show details hidden by VS .SLN file or VS IDE. It does not need to be changed as VISUAL STUdio version evolves. Users can choose other parameters for compiling or linking on demand.


版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念
xml文件介绍及使用
xml编程(一)-xml语法
XML文件结构和基本语法
第2章 包装类
XML入门的常见问题(二)
Java对象的强、软、弱和虚引用
JS解析XML文件和XML字符串详解
java中枚举的详细使用介绍
了解Xml格式
XML入门的常见问题(四)
深入SQLite多线程的使用总结详解
PlayFramework完整实现一个APP(一)
XML和YAML的使用方法
XML轻松学习总节篇