On Tue, Mar 08, 2005 at 11:25:53AM -0600 Billy Patton wrote:

> First I have had this xs hooked in to this library (compiled as c) for over 
> 8 years and everything is OK.  I now have a need for it to be a c++ library 
> to interface with other libraries.  I know I can still call the c 
> libraries, but I've been trying to learn c++ and want to take advantage of 
> STL to reduce my code.  I've had hash table, lists and strings that I 
> support and would rather use STL.
> 
> Below are my Makefile.PL
> perl -V
> g++ -v
> and the results of make
> It's the results of make that I don't know about.
> Any suggestions would be helpful.  Thankyou
> 
> 
> 
> Now I've changed my Makefile.PL to look very similar to the web page above.
> Here it is:
> use ExtUtils::MakeMaker;
> $PLATFORM = `uname`;
> $CC = 'g++';
> WriteMakefile(
>   'NAME'                =>  'Laff'
>  ,'PREFIX'          =>  './'
>  ,'PREREQ_PM'       =>  {}
>  ,'VERSION_FROM'    =>  'Laff.pm'
>  ,ABSTRACT          => 'perl extention of C++ Laff routines written by 
>  Billy Patton'
>  ,'LIBS'                =>  [ 
> '-L/data/cdmg/dev/cdmg_toolbox/Laff/$(PLATFORM) -lcdmg_laff'
>                           , 
>                           '-L/data/cdmg/dev/cdmg_toolbox/libcdmg/$(PLATFORM) 
> -lcdmg'
>                           , 
>                           '-L/data/cdmg/dev/cdmg_toolbox/pcre-5.0/$(PLATFORM) 
> -lpcre'
>                           , ' -lm '
>                         ]
>  ,'OPTIMIZE'        =>   '-g3 -O2'
>  ,'DISTNAME'        =>  'LaffPerl'
>  ,'INSTALLDIRS'     =>  'perl'
>  ,'INC'             => "-I/data/cdmg/dev/cdmg_toolbox/Laff 
> -I/data/cdmg/dev/cdmg_toolbox/libcdmg"
>  ,'XSOPT'           => '-C++'
>  ,'CC'              => 'g++'
>  ,'LD'              => '$(CC)'
>  ,'TYPEMAPS'        => ['typemap' ]
> );
> 
> 
> Here's the top of my .xs :
> #ifdef __cplusplus
> extern "C" {
> #endif
> #include <stdio.h>
> #include "EXTERN.h"
> #include "perl.h"
> #include "XSUB.h"
> #ifdef __cplusplus
> }
> #include "Ui.h"
> #include "ExCommand.h"
> #include "my_string.h"
> #include "Laff.h"
> #endif
> 
> 
> Here are some of the specifics:

[...]

> [EMAIL PROTECTED] LaffPerl]$ make
> cp Laff.pm blib/lib/Laff.pm
> /apps/perl/5.8.0/bin/perl /apps/perl/5.8.0/lib/5.8.0/ExtUtils/xsubpp  -C++ 
> -typemap /apps/perl/5.8.0/lib/5.8.0/ExtUtils/typemap -typemap typemap 
> -typemap typemap  Laff.xs > Laff.xsc && mv Laff.xsc Laff.c
> g++ -c  -I/data/cdmg/dev/cdmg_toolbox/Laff 
> -I/data/cdmg/dev/cdmg_toolbox/libcdmg -D_REENTRANT -D_GNU_SOURCE 
> -DDEBUGGING -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
> -I/usr/include/gdbm -g3 -O2   -DVERSION=\"2.00\" -DXS_VERSION=\"2.00\" 
> -fpic "-I/apps/perl/5.8.0/lib/5.8.0/i686-linux-thread-multi/CORE"   Laff.c
> In file included from /usr/include/c++/3.2.3/bits/basic_ios.h:41,
>                  from /usr/include/c++/3.2.3/ios:51,
>                  from /usr/include/c++/3.2.3/ostream:45,
>                  from /usr/include/c++/3.2.3/iostream:45,
>                  from /data/cdmg/dev/cdmg_toolbox/libcdmg/Ui.h:5,
>                  from Laff.xs:10:
> /usr/include/c++/3.2.3/bits/locale_facets.h:1631:40: macro "do_open" 
> requires 7 arguments, but only 2 given
> /usr/include/c++/3.2.3/bits/locale_facets.h:1643:34: macro "do_close" 
> requires 2 arguments, but only 1 given
> /usr/include/c++/3.2.3/bits/locale_facets.h:1650:55: macro "do_open" 
> requires 7 arguments, but only 2 given

You have a collision between C++ macros and functions defined by perl.
This usually happens when an '#include <iostream>' is present somewhere
in your XS or a header included from there.

You can work around that by doing a 

    #undef do_open
    #undef do_close

    #include "Ui.h"
    ...

If you need to use perl's do_(open|close), use them with their full
names Perl_do_(open|close). 

Tassilo
-- 
use bigint;
$n=71423350343770280161397026330337371139054411854220053437565440;
$m=-8,;;$_=$n&(0xff)<<$m,,$_>>=$m,,print+chr,,while(($m+=8)<=200);

Reply via email to