I have a serious problem with calling references in my php code. I wrapped my c++ class with swig and want to call the method, after I read the manual I figured out that, in SWIG when there is a reference in c++ arguments we have:
class foo {
Public;
double bar(double &a);
}
in swig wrapper class we have:
double foo_bar(foo *obj,double *a) {
obj->bar(*a);}
I totally understand that, my question is how can I call the method bar in PHP code?
I started with:
$ptr_a = &$a
$obj->bar($ptr_a);
but it doesn’t work. Any idea???
I had a go with using phppointers.i and the
REFtypemap to create something that used the PHP concept of a reference. I couldn’t get that to work, but the standard, language neutral SWIG approach to handling things like this with cpointer.i worked just fine:Worked as expected with: