Re: C++ in extension?
| From: | Stanislav Malyshev | Date: | Wed, 28 Nov 2001 13:26:51 +0000 |
| Subject: | Re: C++ in extension? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-71908@lists.php.net to get a copy of this message | ||
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