Hello,
On 10/2/10 5:53 PM, Iñaki Baz Castillo wrote:
Hi, from an external library function I get a pointer
to a \0
terminated string, and I want to get such string as PV value. In the
module code I do:
------------------------------
static str *external_lib_reply;
[...]
static int child_init(int rank)
{
external_lib_reply = pkg_malloc(sizeof(str*));
}
[...]
static int pv_get_external_lib_reply(struct sip_msg *msg, pv_param_t
*param, pv_value_t *res)
{
if (! *external_lib_reply->s) {
LM_ERR("pv 'external_lib_reply' doesn't have value\n");
return pv_get_null(msg, param, res);
}
else {
return pv_get_strval(msg, param, res, external_lib_reply);
}
}
[...]
// Exported module function:
static int w_external_lib_do_request(struct sip_msg* _msg, char* _s1,
char* _s2) {
// Here I get a \0 terminated pointer to char:
char *replied_string;
[...]
replied_string = [...];
// Then I want to assign its value to the PV:
// line 209:
*external_lib_reply->s = replied_string;
// line 210:
*external_lib_reply->len = strlen(replied_string);
remove the '*' from the front of the lines.
Cheers,
Daniel
[...]
}
-----------------------------
I get compilation error in this last part:
209: warning: assignment makes integer from pointer without a cast
210: error: invalid type argument of ‘unary *’ (have ‘int’)
I don't understand the reason of the warning neither the reason of the
error. Any help please?
Thanks a lot.
--
Daniel-Constantin Mierla
http://www.asipto.com