> Hi everyone, > > I am working on an API wrapper that will use both Xalan and MySQL. > > My versions are: > > Xalan-C_1_8_0-windows_2000-msvc_60.zip > xerces-c_2_5_0-windows_nt-msvc_60.zip > mysql 4.0.20 (available at http://dev.mysql.com/downloads/mysql/4.0.html ) > windows 2000 professional service pack 4 > microsoft visual c++ 6.0 > > > The problem occurs when I include the mysql headers before the xalan > headers. It is easy enough to reverse them, but since I am working on an API > I cannot guarantee that my user will not include the mysql api before they > include my wrapper api. Can anyone help? Below I am listing a code snippet > that will compile, one that will not compile, and the errors that are > produced from the bad code snippet.
I downloaded the distribution to test this, and got a compiler error looking for the file my_debug.h, which was nowhere it be found (my install only shows a file called dbug.h, which is apparently the old file name), so I don't know how you even got as far as you did. If I comment out the include of my_debug.h, I can reproduce this problem. However, the conflict is between the C++ standard library template function std::swap<>, and MySQL's my_global.h, which defines a macro called "swap". So, the MySQL headers files are not compatible with _any_ conforming C++ compiler. Given that, I suspect the only way you can make this work is to encapsulate Xalan-C++ within a C API, making sure the Xalan-C++ API code never includes the MySQL header code. You may also have better luck using Microsoft Visual C++ .Net which has a workaround for a similar conflict with a swap function defined in the Windows header files. You should also consider reporting this as a bug with MySQL, although they may explicitly state their APIs are not C++-compatible. Dave
