Re: Linking C++ extensions
| From: | Jon Parise | Date: | Tue, 01 Jan 2008 01:32:08 +0000 |
| Subject: | Re: Linking C++ extensions | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-5013@lists.php.net to get a copy of this message | ||
On Tue, Jan 01, 2008 at 03:42:11AM +0300, Antony Dovgal wrote:
> >> And you're linking against libstdc++, right?
> >
> > I wasn't adding it explicitly, no.
> >
> > I just tried adding libstd++ via PHP_ADD_LIBRARY(...), and that
> > appears to also solve my problem (without having to add the additional
> > parameter to PHP_NEW_EXTENSION).
>
> Well, that was apparently the problem.
I'm not entirely sure I agree with you on this point. We don't
explicitly include the C library when linking with $(CC), for example,
because it is added implicitly by the tool chain.
Is there a reason why we wouldn't want to use $(CXX) to link a
C++-based extension? If seems like that's the only reason that the
optional 'cxx' parameter to PHP_NEW_EXTENSION exists, unless I've
misunderstood the autoconf code (which is entirely possible).
I do appreciate that your suggestion also solved my problem, of
course. Thanks very much for that!
> Well, that's what I use for PECL/rar and I haven't heard any complaints yet.
>
> http://cvs.php.net/viewvc.cgi/pecl/rar/config.m4?revision=1.6&view=markup
You could also use the slightly simpler:
PHP_ADD_LIBRARY(stdc++,, RAR_SHARED_LIBADD)
I don't know which platforms might use a differently-named library;
perhaps they're long-gone or rare beasts.
--
Jon Parise (jon of php.net) :: The PHP Project (http://www.php.net/)