I have code that is straight forward, but intensive. I would like to compile it into a PHP extension. What is the simplest / best practice for going about that?
I have a Java background, so writing the C / C++ code shouldn't be an issue. I would, however, like to avoid any pitfalls along the way.
A simple tutorial or walk through is something I haven't been able to find. Plenty of examples, but nothing aimed at someone new to doing th开发者_运维知识库is.
It looks like a more arduous road then I though, especially with all the lovely C quirks.
The PHP Manual and this Zend article seem to cover quite a bit of ground in regards to writing PHP extensions.
The the tag info for php-extension
and in particular, this answer, also linked from there.
You should try SWIG for generating wrapper for your source code, and then create your extension. It supports various languages like Java, C/C++ and makes it as simple as possible.
精彩评论