Enabling shared on my extension fails to load my library WITH the shared extension

From: Date: Fri, 29 Sep 2000 03:35:15 +0000
Subject: Enabling shared on my extension fails to load my library WITH the shared extension
Groups: php.dev 
Request: Send a blank email to php-dev+get-33858@lists.php.net to get a copy of this message
Hi, I have a question about the config.m4 file that I think just needs another command added to fix my problem, and should be simple for those "in the know". Stay with me whilst reading this. I'm going to try to give as much info without swamping you with too much. I have an extension that makes use of a custom file handler I wrote to output a special type of file. The module works great under Linux (GCC) and WIN32 (MSVC 6.0). No problems all works well... except when under Linux I try to enable shared support for my module. My module was build with the ./ext_skel command as per normal and I've slightly modified the config.m4 file to add support. Basically what happens is that my library (let's say it's called libmyfile.a) and include file (myfile.h) site in a "remote" directory that I specify at the ./configure stage: ./configure --with-myfile --with-myfile-dir=/usr/local/src/myfile (and the rest of the options) This works fine and php sees not only my module, but my library as well. If I change the configuration to: ./configure --with-myfile=shared --with-myfile-dir=/usr/local/src/myfile (and the rest of the options) and update the php.ini file to add: extension=myfile.so (which is in the ./modules directory) it finds my loadable module OK, but then it complains that it can't resolve the address to any of my library functions. I think I know why... When it compiles my module is compiled with the correct include directory with the -I/usr/local/src/myfile/include statement, but my library doesn't get loaded until the end when it creates libphp4.la file. Therefore, it hasn't linked my library with my loadable module. So, quite simply, how can I get my library to be loaded with my module? Below is an a copy of my config.m4 file: dnl $Id$ dnl config.m4 for extension myfile PHP_ARG_WITH(myfile, for myfile support, [ --with-myfile Include myfile support]) if test "$PHP_myfile" != "no"; then AC_DEFINE(HAVE_myfile, 1, [ ]) PHP_EXTENSION(myfile, $ext_shared) AC_ARG_WITH(myfile-dir, [ --with-myfile-dir[=DIR] where the root myfile src directory is installed],[ if test -z $withval; then withval="/usr/local/src/myfile" fi AC_ADD_LIBRARY_WITH_PATH(myfile, $withval/lib) AC_ADD_INCLUDE($withval/include) ]) fi Any help would be greatly appreciated. Thanks, Mike Berry-Porter mikebp@avlerstone.com.au

« previous php.dev (#33858) next »