RE: [PHP] How to call user written C functions in PHP?

From: Date: Tue, 29 Aug 2000 01:54:42 +0000
Subject: RE: [PHP] How to call user written C functions in PHP?
Groups: php.general 
Request: Send a blank email to php-general+get-14041@lists.php.net to get a copy of this message
What exactly are you trying to do? Has your client given you a library of C functions or a stack of C source to use? I am trying to use C library functions written by my co-workers. I guess the easiest way is to write the same function in PHP instead of using the existing C function. Anyway, if you want to call C from PHP your got roughly two options. 1) Add the C functions to PHP itself like a lot of the other libraries i.e. imap_* ereg_* or mysql_*. Or 2) write small C program wrappers around the functions that you need and them call them from PHP using exec(). Of the two options you can ignore option 1) unless you are a hardcode PHP and C code hacker and have too much spare time. Number 2) is probably the way to go. Your C program wrapper would take any input on the command line through argv[] and return results back to PHP by printing them to stdout. I agree that option 2 is the wise option to take. thanks a lot for your help. ---Sonia

« previous php.general (#14041) next »