|
Posted by Toby Inkster on 01/25/07 08:34
balakrishnan.dinesh wrote:
> I need to call a C program function from php code, Is that possible, If
> it is ,then tell me how ?
As Kimmo said, you can't call a C function as-is. One option would be, as
he says, to compile it into a standalone executable, reading the
function's parameters from the command-line arguments, and then call the
compiled executable using a system() function in PHP.
However, if your C function wishes to receive an array or object parameter
you will probably need to compile the C function as a PHP extension. PHP
extensions become available as if they were normal built-in functions of
PHP. This method is a lot more complicated, but ultimately should provide
a faster and more stable solution. It makes it easier to link against a
large C library.
Help on creating extensions is here:
http://uk.php.net/manual/en/zend.creating.php
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|