Ok, so I've built an extension that uses a C++ library. It compiles fine
but the build system is insisting on linking with gcc no matter what I
tell it. Is there some simple trick I'm missing as far as convincing it
to use g++ goes?
Here is the config.m4 in case I've missed something in there...
PHP_ARG_ENABLE(mmsr, whether to enable mmsr support,
[ --enable-mmsr=dir Enable mmsr support])
if test "$PHP_MMSR" != "no"; then
PHP_ADD_LIBRARY_WITH_PATH(mmsr, "$PHP_MMSR")
PHP_ADD_INCLUDE("$PHP_MMSR/MMSR")
PHP_NEW_EXTENSION(mmsr, mmsr.c "$PHP_MMSR/MMSR/mmsr_bridge.cpp",
$ext_shared)
PHP_REQUIRE_CXX()
fi
I had expected the PHP_REQUIRE_CXX() macro to trigger a change to the
link command, but it does not seem to have done anything beyond
influencing what is used to compile the extension itself.
-Stut
Ok, so I've built an extension that uses a C++ library. It compiles fine
but the build system is insisting on linking with gcc no matter what I
tell it. Is there some simple trick I'm missing as far as convincing it
to use g++ goes?Here is the config.m4 in case I've missed something in there...
PHP_ARG_ENABLE(mmsr, whether to enable mmsr support,
[ --enable-mmsr=dir Enable mmsr support])if test "$PHP_MMSR" != "no"; then
PHP_ADD_LIBRARY_WITH_PATH(mmsr, "$PHP_MMSR")
PHP_ADD_INCLUDE("$PHP_MMSR/MMSR")
PHP_NEW_EXTENSION(mmsr, mmsr.c "$PHP_MMSR/MMSR/mmsr_bridge.cpp",
$ext_shared)
PHP_REQUIRE_CXX()
fiI had expected the PHP_REQUIRE_CXX() macro to trigger a change to the
link command, but it does not seem to have done anything beyond
influencing what is used to compile the extension itself.
PECL/rar is C++ (or sort of C++) extension, so you can use its config.m4 as an example.
Here it is: http://cvs.php.net/viewvc.cgi/pecl/rar/config.m4?revision=1.6&view=markup
--
Wbr,
Antony Dovgal
I had expected the PHP_REQUIRE_CXX() macro to trigger a change to the
link command, but it does not seem to have done anything beyond
influencing what is used to compile the extension itself.
Hi,
I think you have to add stdc++ with PHP_ADD_LIBRARY().
I do have a C++ ext internally here, and it still try to link with gcc
and not g++. Still, it does work.
Sincerely,
Olivier
PHP_NEW_EXTENSION(mmsr, mmsr.c "$PHP_MMSR/MMSR/mmsr_bridge.cpp",
$ext_shared)
PHP_NEW_EXTENSION(mmsr, mmsr.c "$PHP_MMSR/MMSR/mmsr_bridge.cpp",
$ext_shared,,,1)
Ref: aclocal.m4 / EEPHP:Chapter 17
-Sara
Sara Golemon wrote:
PHP_NEW_EXTENSION(mmsr, mmsr.c "$PHP_MMSR/MMSR/mmsr_bridge.cpp",
$ext_shared)PHP_NEW_EXTENSION(mmsr, mmsr.c "$PHP_MMSR/MMSR/mmsr_bridge.cpp",
$ext_shared,,,1)Ref: aclocal.m4 / EEPHP:Chapter 17
Thanks to all who replied. I have it working now.
Sara: I have ordered your book, but this couldn't wait until it arrives.
Thanks again.
-Stut