Here is my Makefile.PL.

use 5.008;
use ExtUtils::MakeMaker;
$CC = 'g++';
$LD = 'g++';
$s = `uname`;
$PLATFORM = ($s eq 'Linux') ? 'lnx86' : 'sun' ;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
'NAME' => 'OAPerl',
,'VERSION_FROM' => 'OAPerl.pm'
,'PREREQ_PM' => {}
,ABSTRACT => 'perl extention of C++ OpenAccess database'
,AUTHOR => 'Billy N. Patton <[EMAIL PROTECTED]>'
,'LIBS' => ['-L/data/cdmg/dev/cdmg_toolbox/OAPerl/OA/tools.lnx86/lib -lcdsCommonMT_sh -lclsMT_sh_g -loaDBMT_g -loaLangCPP
_g -lcdsCommonMT_sh_g -lcls_sh -loaDB_g -loaTC -lcdsCommon_sh -lcls_sh_g -loaDD -loaTCMT -lcdsCommon_sh_g -loaBase -loaDDMT -loaT
CMT_g -lclaliteMT_sh -loaBaseMT -loaDDMT_g -loaTC_g -lclaliteMT_sh_g -loaBaseMT_g -loaDD_g -loaUpRev -lclalite_sh -loaBase_g -loa
LangCPP -loaUpRev_g -lclalite_sh_g -loaDB -loaLangCPPMT -lclsMT_sh -loaDBMT -loaLangCPPMT_g -lm -lnsl -ldl -lelf ']
,'DEFINE' => ''
,'INC' => "-IOA/tools.lnx86/oa/include -IOA/tools.lnx86/include"
,'XSOPT' => '-C++'
,'CC' => 'g++'
,'LD' => 'g++'
,'TYPEMAPS' => ['typemap' ]
);



Shortened lines do effect it's appearance :)


Nick Ing-Simmons wrote:
SilvioCVdeAlmeida <[EMAIL PROTECTED]> writes:

Hello,

How suitable is h2xs for generating C++Perl bindings?


Not very. A typical C++ .h file has all kinds of constructs h2xs isn't expecting. (namespaces, and overloaded functions, inline members,...)


I couldn't manage
it to work as I expected.

I'm trying to build a Perl module to access a C++ library, closely
following "Extension based on .h and .c files" from h2xs manpage:

1. start dirs:
 h2xs -Afn Pack
2. copy .h and .c (.cc in my case) to Pack/
3. create extension:
 h2xs -Oxan Pack head_1.h head2.h
4. archive and test:
 cd Pack
 perl Makefile.PL
 make dist
 make
 make test

It breaks in make test, because generated Pack.c (-- not Pack.cc as I
wanted --)


The snag is that there are too many conventions .cc is new to me in fact!
.cxx and .cpp are normal ones and even (on case sensative systems .C).
But most C++ compilers can have C++-ness forced upon them.


ask for C compilation, which do not find iostream, string,
and other standard C++ headers.


That bit is faily easy. You need to override CC as g++ (or whatever
your C++ compiler is called -


WriteMakefile(
    'CC'                => 'g++',
    'LD                 => 'g++',
    ...);

Similarly for Win32 with VC++ the is a command line flag to 'cl' which says to treat source as C++.

Note that gcc's -x c++ is not quite enough as it only affects the compile not the link.


Any help would be very appreciated.

Silvio





--
   ___  _ ____       ___       __  __
  / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
 / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
           /___/
Texas Instruments ASIC Circuit Design Methodlogy Group
Dallas, Texas, 214-480-4455,  [EMAIL PROTECTED]



Reply via email to