wapoor: all test code in our labs (including my perl code) is required to use some machine-generated C code at specified points -- no substitutions or translations are allowed.
OK, is this *C source* or a lib? If it's C source without much
dependencies, you may use plain Inline C, like
(this will reverse your nickname in C):
my $name = 'wapoor';
my $eman = reverse_by_c($name);
print "$name, $eman\n";
use Inline C => qq[
SV* reverse_by_c(SV *pname)
{
SV* retval;
STRLEN len, i;
char *eman, *name = SvPV(pname, len);
New(0, eman, len, char);
for(i=0; i<len; i++) eman[i] = name[len-i-1];
eman[len] = '\\0';
retval = newSVpv(eman, len);
Safefree(eman);
return retval;
}
];
This looks fairly simple and might be solvable for
a C programmer within a short time ... ;-)
You can include a lot of source this way, even
Win32 inline assembly will work fine.
(Or didn't I understand you correct and you
don't like plain Inline-C for some reason?)
Regards
mwa | [reply] [d/l] |