I hope this is a reasonable question to ask here. I've tried searching around for quite some time, but to no avail.

I used h2xs to generate the framework for a Perl module from a C header file (the first time I've ever done this). One the features automatically given to me is the ability to access #define'd constants from the C .h header file. This generated code goes into one package. That package appears to make the #define'd constants available as simple subroutines using (in part) AUTOLOAD.

From another package, I 'use' the package with the #define'd constants. When I attempt to access any of the #define'd constants, I do indeed get the appropriate value returned. However, I also get the following warning:

Prototype mismatch: sub CrashDump::dumpsys::CDUMP_MAGIC vs () at CrashDump/blib/lib/CrashDump/dumpsys.pm line 114 (#1) (S unsafe) The subroutine being declared or defined had previously + been declared or defined with a different function prototype.
As best I can tell, this is in part related to the following section of the AUTOLOAD routine in dumpsys.pm (an h2xs-generated file):
{ no strict 'refs'; # Fixed between 5.005_53 and 5.005_61 if ($] >= 5.00561) { *$AUTOLOAD = sub () { $val }; } else { *$AUTOLOAD = sub { $val }; } }
I'm running perl v5.6.0 on Tru64 UNIX V5.1. So $] == 5.006. Thus, the first line (with parens after "sub") is used.

If I edit dumpsys.pm and force it to use the second line (without parens), I don't get the warning. However, I'd rather not do that because (1) dumpsys.pm is a generated file, and (2) it's probably that way for a reason, right?

Your assistance in understanding and possibly fixing this warning message is appreciated. Thanks.


In reply to "Prototype mismatch" using h2xs-generated code by rjbell4

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.