Re: Linking problem with extension written in C++
| From: | Jay Smith | Date: | Mon, 14 Apr 2003 14:19:46 +0000 |
| Subject: | Re: Linking problem with extension written in C++ | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-899@lists.php.net to get a copy of this message | ||
There are a few header files that you have to include with extern "C" so
their names get mangled properly into C++. Try wrapping php.h, php_ini.h
and info.h in extern "C" and see how that goes.
I wrote up a little article on this sort of thing, so if you're interested,
check out http://www.tutorbuddy.com/software/phpcpp/phpcpp/.
J
Grzegorz Godlewski wrote:
> I have written an extension. Unfortunatelly I had to use some C++.
> After building I have some problems with 3 functions:
> zval_add_ref, REGISTER_LONG_CONSTANT, php_error_docref.
> If I include their body within my extension, it's Ok.
> Otherwise I got memory fault under PHP 4.3.0 and
> relocation error: /usr/lib/php/xerces.so: undefined symbol:
> _Z12zval_add_refPP12_zval_struct under 4.3.1. It has been built by gcc
> 3.2.2. Could anyone spend few minutes on it:
>
> http://ggodlewski.host.sk/download/php-xerces/php-xerces-0.1.tar.gz
> It requires xerces-c-2.2.0.
> Problematic places are marked by MEM_FAULT_HACK macro.
>
> Thanks,
> Grzegorz Godlewski