RE: [PHP] calling a C program in php
| From: | WILSON, Nick | Date: | Wed, 16 Aug 2000 07:06:30 +0000 |
| Subject: | RE: [PHP] calling a C program in php | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11937@lists.php.net to get a copy of this message | ||
I'm 99.99% sure that a php script cannot call a C function directly just by
including it. When an include or require is used, the code is effectively
expanded in the calling php script, so your code below would have C code
running in a PHP script. The syntax is similar but it's something completely
different.
I'd suggest compiling and using exec or passthru functions on the C exe, or
else writing a useful new function along the lines of
include_c("my_c_file.c");
which would parse a C file into PHP unless someone else out there has
already ?
I'm not a C guru but can't imagine it would be that difficult for basic C
functions. eg printf. Then again, why would one be using a function that's
already
in the php libraries. Maybe there's a C to PHP parser out there ...
> -----Original Message-----
> From: Jose Lo [mailto:jose.lo@atalho.com]
> Sent: Wednesday, 16 August 2000 10:01
> To: php-general@lists.php.net
> Subject: [PHP] calling a C program in php
>
>
> hello, I would like to know if there is possible about
> calling a function
> written in C.
> something like:
>
> require "lib.c";
>
> then call a functions in lib.c
>
> thanks,
> Jose Lo
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
>