Extensions with C++

From: Date: Sun, 09 Jul 2000 06:08:07 +0000
Subject: Extensions with C++
Groups: php.general 
Request: Send a blank email to php-general+get-5581@lists.php.net to get a copy of this message
Hello all, I am trying to make an extension that uses a library written in C++. I have gotten an extension working with C, and I am currently just trying to make the project have two files, a .c and a .C or .cpp file. The .C or .cpp file does not seem to get compiled at all, instead being passed direct on the libtool line. This is what my project looks like (originally generated with ext_skel), with just pertinent info: Makefile.in (only showing the modified line here): ------------------ LTLIBRARY_NAME = libsword.la LTLIBRARY_SOURCES = sword.c sword_int.C LTLIBRARY_SHARED_NAME = sword.la include $(top_srcdir)/build/dynlib.mk ------------------ sword.c: generated by ext_skel, only added #include "sword_inc.h" and have it call browse_inc(). sword_inc.h: ------------------ BEGIN_EXTERN_C() char * browse_int(char * verse); END_EXTERN_C() ------------------ sword_inc.C: ------------------ #include "php.h" #include "sword_int.h" BEGIN_EXTERN_C(); char * browse_int(char * verse) { char * retval = emalloc(strlen(verse) + 9); sprintf(retval, "<B>%s:</B>", verse); return retval; } END_EXTERN_C(); ------------------ I have tried sword_inc.C with and without the EXTERN_C, but since it isn't compiling, I'm guessing the point is moot right now :) It seems like Zend was planning to add C++ support somehow, since the BEGIN_EXTERN_C macro is defined. Any help would be appreciated. --John Keiser

« previous php.general (#5581) next »