Build Mini-XML DLL with Visual Studio Command Prompt

6 篇文章 0 订阅
    Mini-XML is an excellent API to generate and parse XML. Its web site is: http://www.msweet.org/projects.php?Z3 . It was written in C language. Although there is a Visual Studio project file in the "vcnet" subdirectory of Mini-XML 2.10 to build the library, the project is a bit old and not suitable for various Visual Studio versions. Command prompt is an alternative choice to build 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't forget to read 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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值