Re: C++ in extensions
| From: | Sascha Schumann | Date: | Tue, 12 Dec 2000 14:19:45 +0000 |
| Subject: | Re: C++ in extensions | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40970@lists.php.net to get a copy of this message | ||
On Mon, 11 Dec 2000, Stephen van Egmond wrote:
> Has anyone succeeded in getting C++ code into a PHP extension?
>
> I'm building 4.0.3pl1 under BeOS. If I build my extension using
> ext_skel, it works great. If I:
>
> - Rename the file to .cpp
> - Rename the references from Makefile (and Makefile.in) from .c to .cpp
Remove LTLIBRARY_SOURCES and use LTLIBRARY_OBJECTS_X instead.
I.e. for foo.cpp and bar.cpp:
LTLIBRARY_OBJECTS_X = foo.lo bar.lo
> - Put the contents of the .cpp inside of extern "C" {}
No need to. Only the interface function (get_module) needs to
be declared with C linkage.
- Sascha