Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55804 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7565 invoked from network); 14 Oct 2011 08:49:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Oct 2011 08:49:44 -0000 Authentication-Results: pb1.pair.com header.from=olivier@phppro.fr; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=olivier@phppro.fr; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain phppro.fr from 74.125.82.54 cause and error) X-PHP-List-Original-Sender: olivier@phppro.fr X-Host-Fingerprint: 74.125.82.54 mail-ww0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:59277] helo=mail-ww0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 85/81-29532-7A7F79E4 for ; Fri, 14 Oct 2011 04:49:44 -0400 Received: by wwf5 with SMTP id 5so2730793wwf.11 for ; Fri, 14 Oct 2011 01:49:40 -0700 (PDT) Received: by 10.216.80.71 with SMTP id j49mr37679wee.23.1318582180661; Fri, 14 Oct 2011 01:49:40 -0700 (PDT) Received: from [10.0.1.2] (tal33-3-82-233-80-11.fbx.proxad.net. [82.233.80.11]) by mx.google.com with ESMTPS id fo7sm12879619wbb.20.2011.10.14.01.49.38 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Oct 2011 01:49:39 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Date: Fri, 14 Oct 2011 10:49:38 +0200 Message-ID: <0FE70DAD-7CF9-4EE7-B52D-736CC93876B9@phppro.fr> To: internals@lists.php.net Mime-Version: 1.0 (Apple Message framework v1244.3) X-Mailer: Apple Mail (2.1244.3) Subject: Problem with PHP as a plugin (C++) using embed sapi From: olivier@phppro.fr (Olivier Hoareau) * My use case : [A] is a main program written in C++ [B] is a C++ "plugin" of [A], compiled in a shared library dynamically = loaded (dlopen-like functions) [CX] are a libphpX.so C shared libraries compiled with "--enable-embed", = where "X" is the PHP version number (5.4, 5.3, ..., 5.0) User calls [A] with the version of PHP he/she wants to use (ex: 5.4), = [A] loads [B] using dynamic loading (dlopen-like functions) and = propagate the requested PHP version number, and when executed, [B] tries = to load this specific version of [CX] (let's say [C5.4]) using = dlopen-like functions. * My status : [A] is successfully compiled in program "a" [B] is successfully compiled in shared library in file libb.so C5.4 is successfully compiled in shared library libphp5.4.so (using = ./configure --disable-all --enable-embed && make) * My probem : When trying to load B from A, I got the error "unknown symbol = executor_globals_id" when calling dlopen("libb.so"). executor_globals seems to be a global variable of libphp5.so (there are = several other global variables in libphp5.so). I can't use dlsym() because it is a dlopen() failure. I tried refactoring my code using PHP functions (in [B]), and I have = also the same error with other global variables (such as = php_embed_module, ...) I tried to define executor_globals_id and it worked, but I felt on next = global variables error. I want to be able not to define all PHP global variable in my [B] plugin = if possible. * My environment : MacOSX 10.7 64 bits * Extra information : [A] LDFLAGS =3D -flat_namespace -undefined suppress [B] LDFLAGS =3D -flat_namespace -undefined suppress dlopen() is used with "RTLD_LAZY | RTLD_GLOBAL" Do you have an idea on how to reach my use case ? Thanks ! Olivier Hoareau=