简体   繁体   中英

How can I link with a static C++ library with PHP?

I have a C++ library I would like to link to and use in PHP: libsigx.a

I would like to link with it by putting it in my config.m4 file (Zend).

[config.m4]

PHP_ARG_ENABLE(sigx,
    [Whether to enable the "sigx" extension],
    [ --enable-sigx     Enable "sigx" extension support])

if test $PHP_SIGX != "no"; then
    PHP_REQUIRE_CXX()
    PHP_SUBST(SIGX_SHARED_LIBADD)
    PHP_ADD_LIBRARY(stdc++, 1, SIGX_SHARED_LIBADD)
    PHP_ADD_LIBRARY(stdc++, 1, "libsigx.a")
    PHP_NEW_EXTENSION(sigx, sigx.cc, $ext_shared)
fi

This is not working for me. I can run phpize and ./configure just fine, but when I go to run a test script, it complains about objects in the library not being available.

我在评论中说的有效。

PHP_ADD_LIBRARY_WITH_PATH(sigx, ., SIGX_SHARED_LIBADD) 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM