加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Build Mini-XML DLL with Visual Studio Command Prompt

发布时间:2020-12-16 08:24:37 所属栏目:百科 来源:网络整理
导读:? 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 bu
? 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.0VC ".
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.?
??

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读