But in reply to salva, I seems that perl/swig doesn't understand 'unsigned char *' when I pass a string to my function.
In Perl I wrote this:
$message = 'Hello';
&MyCProgram::CopyString($message);
In my C program I wrote that in order to test simpy test the input (I will need to output something later):
void CopyString(unsigned char *string1) {
FILE *pf;
pf = fopen("test.txt","w+");
fputs(string1,pf);
fclose(pf);
}
And finally we can find this in my interface file:
%apply unsigned char *INPUT { unsigned char *string1 };
extern void CopyString(unsigned char *string1);
When I run my Perl program, I get this error message: Argument "Hello" isn't numeric in subroutine entry at ./index1.pl line 21.
The problem here is that Perl expects a value and not a string. Ideally I would like to pass only the real address of my string.
Have you got any idea how to solve my problem? Any help is welcomed! Merci beaucoup!