I have in [example.cc] a method :
std::string Car::accelerate (std::string n)
{
cout<<n<<endl;
return n;
}
I would like to call this method from a php extension
I wrote this in my [test_php.cc] extension:
char *strr=NULL;
int strr_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &strr, &strr_len) == FAILURE) {
RETURN_NULL();
}
std::string s(strr);
RETURN_STRING(car->accelerate(s),1);
I have the following error:
warning: deprecated conversion from string constant to ‘char*’
/home/me.cc:79: error: cannot convert ‘std::string’ to ‘const char*’ in initialization
/home/me.cc: At global scope:warning: deprecated conversion from string constant to ‘char*’
If i change the return_string(..) _ with a simple call car->accelerate(s)
; it works..it's true it doesn't print anything as a return function. need some help. appreciate