but when I compile the c++ like this:#ifdef cplusplus #define EXTERN_C extern "C" #else #define EXTERN_C extern #endif extern "C" { # include "EXTERN.h" // from the Perl distribution # include "perl.h" } EXTERN_C { void boot_DynaLoader _((CV* cv)); void boot_DBI _((CV* cv)); void boot_DBD__mysql _((CV* cv)); } static void xs_init(){ newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); newXS("DBI::bootstrap", boot_DBI, __FILE__); newXS("DBD::mysql::bootstrap", boot_DBD__mysql, __FILE__); }
I got errors as the following:g++ -g -o dbChg dbWrapper.cc -Wno-deprecated `perl -MExtUtils::Embed - +e ccopts -e ldopts`
It is gcc 2.96 with perl 5.6.1 under linux redhat. Could you please give me some hint to make it work? Thank you so much./tmp/cccNMAhR.o: In function `void __iter_swap<char *, char *, char>(c +har *, char *, char *)': /usr/include/g++-3/stl_iterator.h(.text+0x29): undefined reference to +`boot_DBI' /usr/include/g++-3/stl_iterator.h(.text+0x43): undefined reference to +`boot_DBD__mysql' collect2: ld returned 1 exit status
janitored by ybiC: <code> tags around code block as per Monastery convention, fix minor format faux paus
In reply to question about loading dbi when calling perl from c++ by christine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |