Convert C to PHP?

Is there any tool that uses C code to input and output valid PHP files?

I would like to use the SAC API , but all currently available implementations are available in C, Java, Ruby, and Perl. I wonder if the C implementation can be easily converted to PHP.

+4
source share
2 answers

I have never seen any tool for this; but the method that is usually used when you want to use some C library from PHP is to write a PHP extension that acts as a kind of "bridge" between the user's PHP file and the C library.

How can you use curl library from PHP, for example.


Some interesting comments on this subject:

And, if you are really interested in the subject and are willing to spend some money on it, you can also buy the book Extension and implementation of PHP ( some pages are available as a preview in Google Books ); I saw a couple of times that it was a book to read when she was interested in this subject (in fact, I bought it a while ago, and it is interesting to read, even if you do not plan to write an extension right now)

By the way, the author of this book is also the author of the first four articles that I linked to :-)

+8
source

Answer Simplified wrapper and interface mechanism

It is a huge library and tool and has a steep learning curve, so perhaps you should ask yourself if the API you want to wrap is complex enough to use SWIG, or if it isn’t quick to do it manually.

0
source

Source: https://habr.com/ru/post/1300838/


All Articles