Build Mini-XML DLL with Visual Studio Command Prompt

前端之家收集整理的这篇文章主要介绍了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:
  1. vcvarsall x86
  2. 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
  3. 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:
  1. vcvarsall x86
  2. 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
  3. 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:
  1. vcvarsall x64
  2. 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
  3. 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":
  1. #ifndef WIN32
  2. # include <unistd.h>
  3. #endif /* !WIN32 */
  4. #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:
  1. vcvarsall x64
  2. 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
  3. 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:
  1. EXPORTS
  2. _mxml_strdupf
  3. _mxml_vstrdupf
  4. mxml_ignore_cb
  5. mxml_integer_cb
  6. mxml_opaque_cb
  7. mxml_real_cb
  8. mxmlAdd
  9. mxmlDelete
  10. mxmlElementDeleteAttr
  11. mxmlElementGetAttr
  12. mxmlElementSetAttr
  13. mxmlElementSetAttrf
  14. mxmlEntityAddCallback
  15. mxmlEntityGetName
  16. mxmlEntityGetValue
  17. mxmlEntityRemoveCallback
  18. mxmlFindElement
  19. mxmlFindPath
  20. mxmlGetCDATA
  21. mxmlGetCustom
  22. mxmlGetElement
  23. mxmlGetFirstChild
  24. mxmlGetInteger
  25. mxmlGetLastChild
  26. mxmlGetNextSibling
  27. mxmlGetOpaque
  28. mxmlGetParent
  29. mxmlGetPrevSibling
  30. mxmlGetReal
  31. mxmlGetRefCount
  32. mxmlGetText
  33. mxmlGetType
  34. mxmlGetUserData
  35. mxmlIndexDelete
  36. mxmlIndexEnum
  37. mxmlIndexFind
  38. mxmlIndexGetCount
  39. mxmlIndexNew
  40. mxmlIndexReset
  41. mxmlLoadFd
  42. mxmlLoadFile
  43. mxmlLoadString
  44. mxmlNewCDATA
  45. mxmlNewCustom
  46. mxmlNewElement
  47. mxmlNewInteger
  48. mxmlNewOpaque
  49. mxmlNewReal
  50. mxmlNewText
  51. mxmlNewTextf
  52. mxmlNewXML
  53. mxmlRelease
  54. mxmlRemove
  55. mxmlRetain
  56. mxmlSaveAllocString
  57. mxmlSaveFd
  58. mxmlSaveFile
  59. mxmlSaveString
  60. mxmlSAXLoadFd
  61. mxmlSAXLoadFile
  62. mxmlSAXLoadString
  63. mxmlSetCDATA
  64. mxmlSetCustom
  65. mxmlSetCustomHandlers
  66. mxmlSetElement
  67. mxmlSetErrorCallback
  68. mxmlSetInteger
  69. mxmlSetOpaque
  70. mxmlSetReal
  71. mxmlSetText
  72. mxmlSetTextf
  73. mxmlSetUserData
  74. mxmlSetWrapMargin
  75. mxmlWalkNext
  76. 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.


猜你在找的XML相关文章