Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9867 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51777 invoked by uid 1010); 16 May 2004 03:09:03 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 50211 invoked by uid 1007); 16 May 2004 03:08:54 -0000 Message-ID: <20040516030854.50210.qmail@pb1.pair.com> To: internals@lists.php.net Date: Sun, 16 May 2004 04:08:55 +0100 User-Agent: Mozilla Thunderbird 0.6 (Windows/20040502) X-Accept-Language: en, en-us MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 195.149.46.220 Subject: Extension written in C++ and undefined symbols From: iridium@beyondunreal.com (Peter 'iridium' Waller) I've currently got some libraries written in C++ with various class interfaces, I was going to write an interface between them and PHP but got very stuck trying to get the extension to recognize any C++ linked to it at all.. I spent quite a while searching the archives and google before posting this, and found some advice telling me to set EXTRA_LDFLAGS = -lstdc++. This seemed to fix the odd one or two things, I don't remember what now because that was a while ago.. in my config.m4: PHP_NEW_EXTENSION(nalicity, nalicity.c test.cpp, $ext_shared) in test.cpp: void blah() { printf( "\n\nBlah\n\n" ); } in nalicity.c PHP_FUNCTION(testfunction) { blah(); } Doesn't work unless I rename test.cpp to test.c and change the PHP_NEW_EXTENSION line accordingly. It compiles fine, I just get the error: /usr/bin/php: relocation error: /usr/lib/php/extensions/no-debug-non-zts-20020429/../../../../src/php/exts/nalicity/modules/nalicity.so: undefined symbol: blah when I try to run the PHP and load the dl(). As I said above though, works fine as a plain old C file. Any ideas? I've stayed up all night trying to figure it out but have gotten nowhere. (and on an unrelated note, is there any way I can specify an absolute path to dl()? I feel kinda stupid with all those ../..'s in there.) Thanks in advance for any help, Peter.