> Hello > > I've used h2xs (hence ExtUtils::Constant) to generate bindings for > Augeas [1] library. Augeas header file includes constants defined with > enums: > > enum aug_flags { > AUG_NONE = 0, > AUG_SAVE_BACKUP = (1 << 0), /* Keep the original file with a > .augsave extension */ > AUG_SAVE_NEWFILE = (1 << 1), /* Save changes into a file with > extension .augnew, and do not > overwrite the original file. Takes > precedence over AUG_SAVE_BACKUP */ > AUG_TYPE_CHECK = (1 << 2) /* Typecheck lenses; since it can be very > expensive it is not done by default */ > }; > > h2xs correctly detects these constants, but it will generate a C code > that expects these constants to be #defined. See the generated > const-c.inc: > case 8: > if (memEQ(name, "AUG_NONE", 8)) { > #ifdef AUG_NONE > *iv_return = AUG_NONE; > return PERL_constant_ISIV; > #else > return PERL_constant_NOTDEF; > #endif > } > break; > > This code does not work as the constants are not known to cpp. > > In itself, it not a big problem, but finding out what's wrong is a > pain when you're beginning to learn XS :-/ > > There's a workaround suggested on Sun's blogs [2] which works fine. > (This blog also feature a fine explanation of the enum problem) > > HTH > > [1] http://augeas.net/ > [2] http://blogs.sun.com/akolb/entry/pitfals_of_the_perl_xs > As a side note, there have been several fixes that have gone into h2xs since that blog entry was created, so I'm not sure how relevant it may still be. Setting the precedent for --skip-ppport is a bit troubling. I had thought that all the enum problems had been nailed down though. Is there a particular .h that is causing problems. What was the exact command line you were using? Steve Peters steve@fisharerojo.orgThread Previous