You are here: Re: how to call C program function from PHP « PHP Programming Language « IT news, forums, messages
Re: how to call C program function from PHP

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация