add two shared libraries in php extension. WHO?
I have a sharedlib.cc and a sharedlib.h code that contains classes and meth开发者_开发百科ods. I wrap this up and created a shared library called MySharedLibrary.so.
I would like to work with my .so library inside a php code. So I've created a config.m4 file , a php_code.cc file and a php_code.h file in order to make the extension from php possible. I DON'T WANT TO include in the config.m4 file the sharedlib.cc. I would like to include instead the MySharedLib.so because I don't want to expose my sharedlib.cc code. Besides I have others library that I also included in my .so library. Need some help.
EDIT:!!
I DON;T WANT TO INCLUDE IN THE CONFIG.M4 THE FILE: sharedlib.cc. I want to include only the sharedlib.h and MySharedLibrary.so (the lib that contains both the sharedlib.cc and sharedlib.h)
I believe the PHP_ADD_LIBRARY()
macro in config.m4
will achieve this.
You can find some examples here: http://devzone.zend.com/article/4486
edit: you may need PHP_ADD_LIBRARY_WITH_PATH()
if your shared lib isn't somewhere that the linker will find it.
edit 2: looks like this was covered before; the answer provides good example code.
精彩评论