Posted by NC on 09/27/98 11:44
wong_powah@yahoo.ca wrote:
>
> I define some constants in C header file.
> e.g.
> const int MAX = 10;
>
> How do I use the same value of MAX in php without redefining
> MAX in php?
> i.e. it involve how php interact with functions and libraries written
> in other languages, such as C.
Generally speaking, PHP cannot interact with random code. If you want
PHP to use entities defined in C, you must write a PHP extension and
ensure PHP is configured to use that extension.
Alternatively, you could just have your C program set some environment
variables; they will be accessible to PHP as members of the $_ENV
superglobal array.
Other alternatives include using shared memory (only on Unix) and
wrapping your C program into a Web service...
Cheers,
NC
[Back to original message]
|