calling a native library

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • user@domain.invalid

    calling a native library

    I am developing a PHP site to run on a Linux server. I need to access a
    proprietary algorithm that is compiled into a C shared object.

    I have been looking for the best way to do this and noticed that I can
    write a Zend engine extension to allow me to do this but I was wondering
    if there was a more simple way.

    Is a PHP library that allows me to load and the .so file without having
    to write my own wrapper (sort of like a dlopen() or LoadLibrary() for
    PHP)? I have looked at the PHP manual on PHP.net but couldn't see anything.

    Are there any other alternatives or is the Zend extension the best/only way.

    I am more familiar with C & C++ than PHP so forgive me if this is a
    stupid question.

    Thanks very much in advance
    Andy


  • Colin McKinnon

    #2
    Re: calling a native library

    user@domain.inv alid wrote:
    [color=blue]
    > I am developing a PHP site to run on a Linux server. I need to access a
    > proprietary algorithm that is compiled into a C shared object.
    >
    > I have been looking for the best way to do this and noticed that I can
    > write a Zend engine extension to allow me to do this but I was wondering
    > if there was a more simple way.
    >
    > Is a PHP library that allows me to load and the .so file without having
    > to write my own wrapper (sort of like a dlopen() or LoadLibrary() for
    > PHP)? I have looked at the PHP manual on PHP.net but couldn't see
    > anything.
    >
    > Are there any other alternatives or is the Zend extension the best/only
    > way.
    >[/color]

    I'm not aware of anything like you suggest. Wite your own main(argc, argv)
    function to call it then use one of the program execution fns in PHP? I
    guess by the time you created a daemon wrapper around the library and wrote
    the PHP end, you'd probably be as quick building it into a PHP extension.

    C.


    Comment

    Working...