Hello Friends, I am developing a .so file (shared module ) on linux 7.1 . I got following sample source code from www.php.net. which I saved in Test.cpp file. /* include standard header */ #include "php.h"
/* declaration of functions to be exported */ ZEND_FUNCTION(first_module); /* compiled function list so Zend knows what's in this module */ zend_function_entry firstmod_functions[] = { ZEND_FE(first_module, NULL) {NULL, NULL, NULL} }; /* compiled module information */ zend_module_entry firstmod_module_entry = { STANDARD_MODULE_HEADER, "First Module", firstmod_functions, NULL, NULL, NULL, NULL, NULL, NO_VERSION_YET, STANDARD_MODULE_PROPERTIES }; /* implement standard "stub" routine to introduce ourselves to Zend */ #if COMPILE_DL_FIRST_MODULE ZEND_GET_MODULE(firstmod) #endif /* implement function that is meant to be made available to PHP */ ZEND_FUNCTION(first_module) { long parameter; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", ¶meter) == FAILURE) { return; } RETURN_LONG(parameter); } I compliled it as follows: g++ -fpic -DCOMPILE_DL=1 -I/usr/local/include -I. -I.. -I../Zend -c -o Test.o Test.cpp and linked it as: g++ -shared -L/usr/local/lib -rdynamic -o LibTest.so Test.o After executing these commands, I got a libTest.so library, that I copied into /usr/lib/php4 directory. Now problem is when I call it from .php file by using statement dll("libTest.so); I got a warnning "Invalid library (maybe not a PHP library) 'libTest.so' in /var/www/html/Test.php on line 6" Help me. I shall be very thankful. Sanjay Chauhan -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php