Hi all,
I am using C as source code and the backend as PERL code.
I am trying to convert a string to integer.
In C I have written this piece of code which does a typecast of the string to integer,
uint8_t * changeCharToInt (char *ip, uint8_t *result)
{
printf ("Address: %s\n",ip);
result = (uint8_t *) ip;
printf("Result: %s\n", *result);
return result;
}
In PERL I am trying to call the above function using the SWIG Interface File:
%include <typemaps.i>
extern unsigned int * changeCharToInt (char *INPUT, unsigned int *OUTPUT);
From the C code I want to store the return ‘result’ in the second parameter using a typemap which will be passed to the PERL function as follows,
$result;
$ip = '10.100.19.100';
$value = changeCharToInt ($ip, \$result); (Tried passing the direct value)
print "$value\n"; #Prints the reference
print "$result\n"; #Prints nothing empty
But the value is not being stored in the variable. It shows the empty variable while trying to print $result value in PERL
Please reply ASAP...