Hi guys, I am new in this area of writing extension for PHP, however I need to create a wrapper class for C++ to PHP. I am currently using PHP 5.2.13. I read this article http://devzone.zend.com/article/4486-Wrapping-C-Classes-in-a-PHP-Extension, a tutorial on how I could proceed to wrap C++ class to communicate with PHP Zend however it is written to for linux system. Do you guys have any article or advice on how I could proceed to write a wrapper class to communicate with PHP?
+1
A:
The best "documentation" you'll find is the source code of PHP and is extensions (sorry). You'll find you have to dig into the sources (especially the headers of the Zend engine) as soon as you're doing something non-trivial.
Having said this, there are a few resources you might find useful to get you started. See these articles and Extending and Embedding PHP by Sara Golemon. See also pecl.php.net/support.php
Artefacto
2010-03-25 15:09:32
@ John FactorialThanks for the reply. I made my extension using ubuntu instead of window now and manage to build a extension with the help from the community and Sara book =)But unfortunately I have face another problem. I tried to convert an memory intensive C++ application to php extension. It work fine in C++ but as an extension. The result from the extension always seem to be different each time i execute. I suspect because the object created is not cleared. Still trying to figure out this problem, do any body have any issue with the memory when building php extension?
Yijinsei
2010-05-21 03:15:31
As with all C/C++ code, memory-related issues abound and can have a variety of causes. Different results every time you run indicates some function may be returning a pointer to a variable that has gone out of scope, or in some other way accessing memory that is no longer valid. Also, PHP is often run in a multi-threaded environment, so that could be your problem. Impossible to know without code and a better description of your problem. I suggest you ask a new question about it.
John Factorial
2010-05-21 13:14:15