I am using SWIG to wrap my C++ source code, but my code has pointers and references. How can I write my PHP code to use these functions? My C++ class is as follows:
Bitmap : public Image
{
public:
void fillColor(const unsigned int *color);
};
How can I call fillColor() in my PHP code?
I think this is what you’re looking for : http://www.swig.org/Doc1.3/Php.html#Php_nn2_5
You have 3 options – I’d think the most natural would be to simply include “phppointers.i” to your .swg or .i swig files and call your vars REF.
Then you can just use them in PHP as you would in C++, but they are called references instead of pointers (just write an ampsersand & before the $ of your variable).