Re: C++ in extension?

From: Date: Wed, 28 Nov 2001 14:48:34 +0000
Subject: Re: C++ in extension?
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-71933@lists.php.net to get a copy of this message
correction: it seams that using the 'string' from stdlib makes the difference. If I: #include <string> using namespace std; ... it doesnt work - but only if I *use* the string class.... strange. anyone got any Idea why? - Lars "Stanislav Malyshev" <stas@zend.com> wrote in message news:Pine.LNX.4.33.0111281523380.12526-100000@shire.zend.office... > LK>> Can anybody tell me why I get an "Call to undefined function" > LK>> when compiling a module using a C++ compiler (made a small test > LK>> - it works fine when renaming the extension to *.c ... ). There > LK>> are no make errors. The *only* error is that PHP seams unable > LK>> to find the function when compiled using C++. Isn't it possible > LK>> to do C++ in PHP extensions?!?!? BTW: I'm using gcc on a Linux > LK>> RH7.2 -thanx > > Yes, it's possible to do C++. > > I think you should use extern "C" on functions that should be used from > PHP, since PHP is C program and doesn't know about C++ name mangling. I > think wrapping all PHP macros, function defs, PHP includes, etc. in extern > "C" would help. > > -- > Stanislav Malyshev, Zend Products Engineer > stas@zend.com http://www.zend.com/ +972-3-6139665 ext.115 > >

« previous php.dev (#71933) next »