Re: [PHP4BETA] Writing PHP4 Extensions in C++
| From: | thies at digicol dot de | Date: | Wed, 22 Mar 2000 08:39:46 +0000 |
| Subject: | Re: [PHP4BETA] Writing PHP4 Extensions in C++ | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-12480@lists.php.net to get a copy of this message | ||
On Wed, Mar 22, 2000 at 09:20:01AM +0100, Klaus Reimer wrote:
> Hi,
>
> I have written a simple function extension for PHP4 in C and it is working very
> good. I can load the library with dl("test.so") and I can call the function
> mytest() returning a Test string. But finally I want to write the extension in
> C++, so I can use classes and the STL. But when I compile my C-source with the
> C++ compiler g++, PHP is refusing to load the library. It tells me, that
> test.so is not a PHP library.
>
> I have checked the API header files of PHP4 and there a LOT of compiler
> switches concerning C++ in them.
>
> Have I to recompile PHP4 with a C++ compiler to be able to use PHP4 extension
> modules written in C++? Is there a configuration switch in the Makefile to
> switch to C++? Or is it just impossible to use C++ code for PHP4 extension
> libraries?
you should be able to do so - plz make sure that u export the
get_module() symbol as extern "C". that's the one and only
enty point dl() needs to initialize a .so module!
>
> Bye
> K
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
--
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany