>Number:         4045
>Category:       apache-api
>Synopsis:       Cannot load dynamic modules written in C++
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          sw-bug
>Submitter-Id:   apache
>Arrival-Date:   Thu Mar 11 15:20:01 PST 1999
>Last-Modified:
>Originator:     [EMAIL PROTECTED]
>Organization:
apache
>Release:        1.3.3
>Environment:
Linux 2.0.36 (RedHat 5.2)
gcc 2.7.2.3
C++ stuff with egcs-2.90.29
>Description:
I am developing an Apache module which uses an in-house library which is 
written in C++.  I want to build the module as a DSO.  I can get the module to 
load by using LoadFile to pull in the C++ runtime first; but the constructors 
on global objects (e.g., cerr) don't get invoked.
>How-To-Repeat:
Build a module in C++ and have it print messages to cerr.  If necessary, I can 
write you some example code.
>Fix:
Yes, I have a fix: I added two dummy C++ files to the Apache build (two so that 
one can call into the other and make the linker think it's being used) and 
linked httpd with g++ instead of gcc.  This worked fine (the module still has to
avoid using any global objects with constructors of its own, but that'll have 
to do).

I have put together a patch to the configuration scripts to add this fix if 
(and only if) configure is invoked with "--cplusplusmodules".  It picks a C++ 
compiler just the way it normally picks a C compiler.  It does not affect the 
compilation of C files.  The patch is available at 
<http://www.thibault.org/cplusplusmodules.tar.gz>.  The tarfile contains:

* Output of "diff -r -C3 dist patched" (where dist is the distributed source of 
1.3.3, and patched is my modified version)
* patched/src/dummy.C
* patched/src/dummy.H
* patched/src/dummy2.C

(where the last 3 are the dummy C++ files used)
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <[EMAIL PROTECTED]> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]



Reply via email to