Hi all,
I'm trying to use a C++ library from Perl using Inline::CPP. The problems I've found so far
can be reproduced with the simple program below.
1. virtual destructor is not supported
2. The Editor::Copy() method clashes with some other from the Perl library (handy.h?)
Thank you for any help.
- Subir ----------------------------------------------------------------------------------------------------------------------------------- use Inline CPP;
my $e = new Editor; $e->cut;
__END__ __CPP__
class Editor { public: Editor() {} ~Editor() {} // Does not seem to support virtual destructor virtual void Print(); virtual void Cut(); virtual void Copy(); // handy.h has another Copy() virtual void Paste(); };
void Editor::Print() { cout << "Object (" << this << ")" << endl; } void Editor::Cut() { cout << "Cut text" << endl; } void Editor::Copy() { cout << "Copy text to buffer" << endl; } void Editor::Paste() { cout << "Paste text from buffer" << endl; }
pcsarkar [392] perl -w Editor.pl
/usr/bin/perl /usr/lib/perl5/5.8.5/ExtUtils/xsubpp -typemap /usr/lib/perl5/5.8.5/ExtUtils/typemap -typemap /home/sarkar/Perl/root_examples/_Inline/build/Editor_pl_b8fe/CPP.map Editor_pl_b8fe.xs > Editor_pl_b8fe.xsc && mv Editor_pl_b8fe.xsc Editor_pl_b8fe.c
g++ -c -I/home/sarkar/Perl/root_examples/ -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -g -pipe -march=i386 -mcpu=i686 -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC "-I/usr/lib/perl5/5.8.5/i386-linux-thread-multi/CORE" Editor_pl_b8fe.c
In file included from /usr/include/c++/3.2.3/backward/iostream.h:31,
from Editor_pl_b8fe.xs:2:
/usr/include/c++/3.2.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <sstream> instead of the deprecated header <strstream.h>. To disable this warning use -Wno-deprecated.
Editor_pl_b8fe.xs:22:21: macro "Copy" requires 4 arguments, but only 1 given
Editor_pl_b8fe.xs:22: variable or field `Copy' declared void
Editor_pl_b8fe.xs:22: `Copy' declared as a `virtual' field
Editor_pl_b8fe.xs:32:19: macro "Copy" requires 4 arguments, but only 1 given
Editor_pl_b8fe.xs:32: syntax error before `{' token
Editor_pl_b8fe.c:55: confused by earlier errors, bailing out
make: *** [Editor_pl_b8fe.o] Error 1
A problem was encountered while attempting to compile and install your Inline
CPP code. The command that failed was:
make > out.make 2>&1
The build directory was: /home/sarkar/Perl/root_examples/_Inline/build/Editor_pl_b8fe
To debug the problem, cd to the build directory, and inspect the output files.
at Editor.pl line 0 INIT failed--call queue aborted.