Hello Perl XS readers,
When I put an "OUTPUT:" into my VISA.xs file, I get this compile
message:
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
VISA.c
VISA.c(156) : error C2065: 'XFree' : undeclared identifier
Here's the paragraph from the .xs file:
long
viOpenDefaultRM(vi)
unsigned long *vi
OUTPUT:
vi
The code in VISA.c (which was generated from VISA.xs) runs thus:
XS(XS_VISA_OpenDefaultRM)
{
dXSARGS;
if (items != 1)
croak("Usage: VISA::OpenDefaultRM(vi)");
{
unsigned long * vi = (unsigned long *)SvPV(ST(0),PL_na);
long RETVAL;
RETVAL = viOpenDefaultRM(vi);
>>>> sv_setpvn(ST(0), (char *)vi, sizeof(*vi)), XFree((char *)vi);
SvSETMAGIC(ST(0));
ST(0) = sv_newmortal();
sv_setiv(ST(0), (IV)RETVAL);
}
XSRETURN(1);
}
Note the ">>>>". I have two questions.
First, from what I see in lib/CORE/proto.h, sv_setpvn should
have 3 params, not 4. What's happening here?
Second, I have searched in the Perl directory, and
the only files that contain "XFree" are typemap and xsubpp.
How is the reference to XFree supposed to be satisfied?
The occurrence of XFree in typemap is thus:
T_OPAQUEPTR
sv_setpvn($arg, (char *)$var, sizeof(*$var)), XFree((char *)$var);
The occurrence of XFree in xsubpp is in sub generate_output, thus:
if ($type =~ /^array\(([^,]*),(.*)\)/) {
print "\tsv_setpvn($arg, (char *)$var, $2 * sizeof($1)), XFree((char
*)$var);\n";
print "\tSvSETMAGIC($arg);\n" if $do_setmagic;
So it looks like it's being generated by the entry in the typemap file.
Which is odd, since I don't think a pointer to a long should be
regarded as an opaque ptr.
Any ideas would be most gratefully received.
Thanks,
Mitch.
--
| mailto:[EMAIL PROTECTED] | Not the official view of: |
| mailto:[EMAIL PROTECTED] | Australian Calculator Opn |
| Certified Linux Evangelist! | Hewlett Packard Australia |