Extension written in C++ and undefined symbols

From: Date: Sun, 16 May 2004 03:08:55 +0000
Subject: Extension written in C++ and undefined symbols
Groups: php.internals 
Request: Send a blank email to internals+get-9867@lists.php.net to get a copy of this message
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.

« previous php.internals (#9867) next »