Apache fails to start when Xerces is used in a C++ module

Alles, was den Apache betrifft, kann hier besprochen werden.

Apache fails to start when Xerces is used in a C++ module

Postby sindhi.for » 31. March 2013 10:02

Hello,

I have written a C++ module to invoke the Xerces C++ XML library to parse a XML file. I'm unable to start httpd.exe with these changes. Here are the details -

a) Apache server version: httpd-2.4.4-win64
b) Xerces version: xerces-c-3.1.1-x86_64-windows-vc-10.0
c) Development envt: Visual Studio 2010 with SP1

Following are the settings I have made in Visual Studio so that the C++ module refers to the Xerces library:
1. Additional Include Directories = E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\include

2. Additional Dependencies = xerces-c_3.lib and xerces-c_static_3.lib

3. Additional library directories = E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\lib

4. Debugging -> Environment: PATH=E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\bin

5. In the Operating System environment variables, added the path E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\bin to the environment variable PATH

6. The code in my C++ module to invoke the Xerces library routine goes like this -
try {
XMLPlatformUtils::Initialize(); // Initialize Xerces infrastructure
}
catch( XMLException& e ) {
char* message = XMLString::transcode( e.getMessage() );
XMLString::release( &message );
}
XMLPlatformUtils::Terminate();

7. Added the below in httpd.conf file -
LoadModule filter_module modules/XercesDLL.dll
AddOutputFilterByType TagFilter text/html text/plain text/css

8. If i try to launch httpd.exe from command prompt, I see the below error -
>httpd.exe
httpd.exe: Syntax error on line 172 of E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load modules/XercesDLL.dll into server: T
he specified module could not be found.

Even if I comment out the above C++ code in step 6, Apache still fails to start. That means Apache is failing to load the Xerces library version I'm using, irrespective of the way I'm invoking the library.

However, If I write a standalone DLL that invokes the above Xerces library version, and invoke this DLL from an EXE then I'm successfully able to parse the XML. This means, the Xerces library fails to get loaded only by the Apache server for some reason.

I think its got something to do with the C to C++ linkage, not sure tho.

Any help is highly appreciated.

Thanks.
sindhi.for
 
Posts: 2
Joined: 31. March 2013 09:54
Operating System: Windows

Re: Apache fails to start when Xerces is used in a C++ modul

Postby sindhi.for » 31. March 2013 13:41

Ok.... this issue gets resolved by adding the LoadFile directive for the Xerces DLL.
sindhi.for
 
Posts: 2
Joined: 31. March 2013 09:54
Operating System: Windows


Return to Apache

Who is online

Users browsing this forum: No registered users and 4 guests