develooper Front page | perl.perl5.porters | Postings from September 2012

[perl #20636] ExtUtils::Constant trying to make empty #defines accessible

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
September 27, 2012 18:50
Subject:
[perl #20636] ExtUtils::Constant trying to make empty #defines accessible
Message ID:
rt-3.6.HEAD-11172-1348797035-53.20636-15-0@perl.org
On Fri Jan 31 07:54:00 2003, nicholas wrote:
> On Fri, Jan 31, 2003 at 08:02:16AM -0000, tassilo.parseval@post.rwth-
> aachen.de (via RT) wrote:
> 
> > When creating an extension skeleton using
> >
> >     h2xs -O -b <version> -n Module::Name header.h
> >
> > it appears as though ExtUtils::Constant tries to make symbols
> exportable
> > that are merely #defined but have no value.
> 
> > The above problem remains when removing the two offending symbols
> > (__BEGIN_DECLS and __END_DECLS) from the NAMES-list in
> > ExtUtils::Constant::WriteConstants() in Makefile.PL.
> 
> 
> > An excerpt from the header I've been using:
> >
> >     #ifndef __MPLIB_H
> >     #define __MPLIB_H
> >     #undef __BEGIN_DECLS
> >     #undef __END_DECLS
> >     #ifdef __cplusplus
> >     # define __BEGIN_DECLS extern "C" {
> >     # define __END_DECLS }
> >     #else
> >     # define __BEGIN_DECLS /* empty */
> >     # define __END_DECLS /* empty */
> >     #endif
> 
> 
> ExtUtils::Constant is just doing what it's told by h2xs. The real
> cause
> will be some sort of bug in h2xs that thinks that those two macros are
> defined. I suspect it's getting it wrong in the code somewhere near
> here:
> 
>     # Remove macros which expand to typedefs
>     print "Typedefs are @td.\n" if $opt_d;
>     my %td = map {($_, $_)} @td;
>     # Add some other possible but meaningless values for macros
>     for my $k (qw(char double float int long short unsigned signed
> void)) {
>       $td{"$_$k"} = "$_$k" for ('', 'signed ', 'unsigned ');
>     }
>     # eval {require 'dumpvar.pl'; ::dumpValue( [\@td, \%td] ); 1} or
> warn $@;
>     my $n = 0;
>     my %bad_macs;
>     while (keys %td > $n) {
>       $n = keys %td;
>       my ($k, $v);
>       while (($k, $v) = each %seen_define) {
> 	# print("found '$k'=>'$v'\n"),
> 	$bad_macs{$k} = $td{$k} = $td{$v} if exists $td{$v};
>       }
>     }
>     # Now %bad_macs contains names of bad macros
>     for my $k (keys %bad_macs) {
>       delete $const_names{$prefixless{$k}};
>       print "Ignoring macro $k which expands to a typedef name
> '$bad_macs{$k}'\n" if $opt_d;
>     }
> 
> 
> Not that I know how to fix it from a superficial look.
> 
> Nicholas Clark
> 

Another ticket which has been languishing in the "Open" queue for many
years. ni-s is no longer with us.  Is there someone -- particularly
someone familiar with XS -- who could review the issues in this ticket
and make a recommendation?

Thank you very much.
Jim Keenan

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=20636

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About