3

I have a sharedlib.cc and a sharedlib.h code that contains classes and methods. 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)

hakre
  • 193,403
  • 52
  • 435
  • 836
sunset
  • 1,359
  • 5
  • 22
  • 35

1 Answers1

4

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.

Community
  • 1
  • 1
mh.
  • 802
  • 1
  • 7
  • 20
  • do i need to add both the php_code.so and my MySharedLibrary.so in the file php.ini? – sunset Sep 02 '11 at 07:10
  • could u please give me a shot example with how to add in php extension (config.m4) multiple .so files? APPRECIATE A LOT!! THANK YOU – sunset Sep 02 '11 at 07:11