Excerpts from the mail message of Mitch Davis:
) 
) When I put an "OUTPUT:" into my VISA.xs file, I get this compile
) message:
[...]
) VISA.c(156) : error C2065: 'XFree' : undeclared identifier
[...]
) long
) viOpenDefaultRM(vi)
)     unsigned long *vi
)   OUTPUT:
)     vi

Simply change the second line to:

        unsigned long &vi

) >>>>  sv_setpvn(ST(0), (char *)vi, sizeof(*vi)), XFree((char *)vi);
[...]
) First, from what I see in lib/CORE/proto.h, sv_setpvn should
) have 3 params, not 4.  What's happening here?

C<sv_setpvn()> _is_ given 3 args above.  Match the parens more
carefully.

) 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?

I don't have a good answer.  The default typemap file appears
to have several undocumented things as far as I can tell.
But it looks like they are expecting you to C<#define XFree>
assuming that your pointer to opaque data needs to be freed
after the contents of the buffer have been copied.  This seems
like a rather silly typemap to me since, among other things, it
expects that only output parameters need to be freed.  Of course,
you have to C<#define XFree> because we don't know whether your
buffer should be freed via C<free>, C<Perl_mfree>, etc.

) 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.

More strange things in the default typemap file.
-- 
Tye McQueen    Nothing is obvious unless you are overlooking something
         http://www.metronet.com/~tye/ (scripts, links, nothing fancy)

Reply via email to