S
Shawn Zabel
I'm looking for suggestions on how to modify a char* argument passed into an
XS function. It's been two days now that a co-worker and I have been trying
to figure this out. We've seen examples on how to modify integers, but
nothing on strings or char pointers. The example below is meant only to
provide a crude example of what we are trying to accomplish. We are very
appreciative of any and all help provided of this issue.
***Example Perl Code***
my $p = "old value";
getLastPrompt($p);
or
getLastPrompt(\$p);
$p now equals "new prompt"
***Example XS Code***
int getLastPrompt(prompt)
char * prompt
CODE:
prompt = "new prompt";
RETVAL = 1;
OUTPUT:
prompt
RETVAL
- Shawn
XS function. It's been two days now that a co-worker and I have been trying
to figure this out. We've seen examples on how to modify integers, but
nothing on strings or char pointers. The example below is meant only to
provide a crude example of what we are trying to accomplish. We are very
appreciative of any and all help provided of this issue.
***Example Perl Code***
my $p = "old value";
getLastPrompt($p);
or
getLastPrompt(\$p);
$p now equals "new prompt"
***Example XS Code***
int getLastPrompt(prompt)
char * prompt
CODE:
prompt = "new prompt";
RETVAL = 1;
OUTPUT:
prompt
RETVAL
- Shawn