jettero has asked for the wisdom of the Perl Monks concerning the following question:

In my Makefile.PL I've got some of this:
ExtUtils::Constant::WriteConstants( NAME => 'Package::Name', NAMES => \@names, DEFAULT_TYPE => 'IV', C_FILE => 'const-c.inc', XS_FILE => 'const-xs.inc', );
And in the const-c.inc, I'm getting this:
if (memEQ(name, "AWESOME_CONSTANT", 16)) { #ifdef AWESOME_CONSTANT + *iv_return = AWESOME_CONSTANT; + return PERL_constant_ISIV; #else return PERL_constant_NOTDEF;

The problem is, AWESOME_CONSTNAT is part of a typedef enum, so it's most definitely not defined.

I can see in the ExtUtils::Constant manpage that there exists an interface (C_constant or macro or something) for changing the behavior of the ExtUtils::Constant #ifdef check, but for the life of me, I literally can't figure it out.

Please help. Thanks in advance, etc.

Replies are listed 'Best First'.
Re: ExtUtils::Constant and C enums
by jettero (Monsignor) on May 04, 2004 at 18:56 UTC
    Wait, I think I get it... Instead of an array of symbols, I can pass an array of hashrefs to WriteConstants() and set macro=>1 .... Yeah, that works!

    Sorry to answer my own question (several hours later).

    use the source luke