I have been attempting to modifie tinyXML to compile into a DLL, i have been most successful exept for the Print function in the example i commented it out and it does not appear to cause problems afterwords...
place the following at the top of each of the .h files
#ifdef WIN32
#ifndef TINYXML_DECL
#ifdef TINYXML_EXPORTS
#define TINYXML_DECL __declspec(dllexport)
#else
#define TINYXML_DECL __declspec(dllimport)
#endif /* TINYXML_EXPORTS */
#endif /* TINYXML_DECL */
#else /* WIN32 */
#define TINYXML_DECL
#endif /* Not WIN32 */
and then add
TINYXML_DECL into the class definitions example:
class TINYXML_DECL TiXmlString
no changes are needed to the cpp files(as far as i know my test worked without needing modify them)
simply add TINYXML_EXPORTS to compiler definitions when compiling as a DLL and dont put TINYXML_EXPORTS in the compiler definitions if not compiling as a dll such as using the dll in a program
add #pragma comment(lib, "tinyxml.lib")
to any programs that use the DLL if in vc++ be sure to create a new DLL project to put all the cpp and h files into, and goto project->settings->c++->Code generation->use run time library and change it to multithreaded dll that seems help cut the files size down a bit.
any questions feel free to email me at luminus(BITEME SPAMMERS)@earthlink.net just remove (BITEMESPAMMERS)
=) luminus the enlightened one
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do have a question :
Why would you DLL'ing TinyXML ?
It's such a small piece of code, you'd rather include it straight into your projects, or if you have many projects set up a tiny library.
I guess I missed something
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmmm, I believe I've followed your example, but I'm running into a number of warnings about the declaration of "struct TiXmlCursor" in "tinyxml.h"
..\TinyXml\tinyxml.h(1288) : warning C4251: 'TiXmlDocument::errorLocation' : struct 'TiXmlCursor' needs to have dll-interface to be used by clients of class 'TiXmlDocument'
..\TinyXml\tinyxml.h(91) : see declaration of 'TiXmlCursor'
If I (blindly) add the TINYXML_DECL thing to that struct def, the warning change somewhat...
Has anyone (else) tried to DLL-ize tinyxml recently?
(To answer the "why" question, I'm using TinyXML as a Registry replacement. Unfortunately, the consumers of (my classes and) TinyXML are both in statically linked areas and DLLs...)
Thanx for any help!
Rich
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have been attempting to modifie tinyXML to compile into a DLL, i have been most successful exept for the Print function in the example i commented it out and it does not appear to cause problems afterwords...
place the following at the top of each of the .h files
#ifdef WIN32
#ifndef TINYXML_DECL
#ifdef TINYXML_EXPORTS
#define TINYXML_DECL __declspec(dllexport)
#else
#define TINYXML_DECL __declspec(dllimport)
#endif /* TINYXML_EXPORTS */
#endif /* TINYXML_DECL */
#else /* WIN32 */
#define TINYXML_DECL
#endif /* Not WIN32 */
and then add
TINYXML_DECL into the class definitions example:
class TINYXML_DECL TiXmlString
no changes are needed to the cpp files(as far as i know my test worked without needing modify them)
simply add TINYXML_EXPORTS to compiler definitions when compiling as a DLL and dont put TINYXML_EXPORTS in the compiler definitions if not compiling as a dll such as using the dll in a program
add #pragma comment(lib, "tinyxml.lib")
to any programs that use the DLL if in vc++ be sure to create a new DLL project to put all the cpp and h files into, and goto project->settings->c++->Code generation->use run time library and change it to multithreaded dll that seems help cut the files size down a bit.
any questions feel free to email me at luminus(BITEME SPAMMERS)@earthlink.net just remove (BITEMESPAMMERS)
=) luminus the enlightened one
I do have a question :
Why would you DLL'ing TinyXML ?
It's such a small piece of code, you'd rather include it straight into your projects, or if you have many projects set up a tiny library.
I guess I missed something
Hmmm, I believe I've followed your example, but I'm running into a number of warnings about the declaration of "struct TiXmlCursor" in "tinyxml.h"
..\TinyXml\tinyxml.h(1288) : warning C4251: 'TiXmlDocument::errorLocation' : struct 'TiXmlCursor' needs to have dll-interface to be used by clients of class 'TiXmlDocument'
..\TinyXml\tinyxml.h(91) : see declaration of 'TiXmlCursor'
If I (blindly) add the TINYXML_DECL thing to that struct def, the warning change somewhat...
Has anyone (else) tried to DLL-ize tinyxml recently?
(To answer the "why" question, I'm using TinyXML as a Registry replacement. Unfortunately, the consumers of (my classes and) TinyXML are both in statically linked areas and DLLs...)
Thanx for any help!
Rich