Thanks for reply.
But this approach does not solve my problem. On further investigation I have found out a clue that why this is behaving like this with Perl v5.8.3, but can not find the solution.
I have already metioned I have xs file, a.xs where the xs code is present. I have also a .map file say c.map file in c.map file I have written following code (the code has been taken from Advanced Perl Programming book)
TYPEMAP
const char * T_PV
test_class * ANY OBJECT
OUTPUT
ANY OBJECT
sv_setref_pv($arg, CLASS, (void *) $var);
INPUT
ANY OBJECT
$var = ($type) SvIV((SV*)SvRV($arg));
Now when Perl v5.6.1 generates .c file from .xs file following code was generated
XS(XS_Test_TestMethod)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Test::TestMethod(CLASS, param1)");
{
char* CLASS = (char *)SvPV(ST(0),PL_na);
pstruct * param1;
On the other hand Perl v5.8.3 generated following code
XS(XS_Test_TestMethod)
{
dXSARGS;
if (items != 2)
Perl_croak(aTHX_ "Usage: Test::TestMethod(CLASS, param1)");
{
char* CLASS = (char *)SvPV_nolen(ST(0));
pstruct * param1 = (pstruct *) SvIV((SV*)SvRV(ST(1)));
Can anybody please tell me why code generation is different for Perl v5.6.1 and Perl v5.8.3? I also doubt that code generated by Perl v5.8.3 may cause problem in my script when no valid reference address passed to the TestMethod.
Can anybody kindly give me any pointers to overcome this problem?
Thanks in advance.
Regards
-Pijush
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.