This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Problems with Perl XS module in C++ on Cygwin


I'm having trouble building a Perl XS module in C++ on
Cygwin. I've got Cygwin 1.3.12-2 and I've tried Perl
5.6.1 and Perl 5.8.0. This module has built and run
successfully on Linux. I used the XS C++ guidelines in
http://www.johnkeiser.com/perl-xs-c++.html

The first problem is caused by the macro definition of
vform in perl.h. This causes 

/usr/include/g++-3/streambuf.h:405: parse error before
`const'

when a C++ declaration for vform is encountered. I
worked around this by adding

#undef vform

after the Perl includes. Since none of my code uses
vform I believe this is safe, but there is probably a
better solution to this problem.

The second problem shows up when linking the shared
object. I get the following error:

/usr/lib/libcygwin.a(libcmain.o)(.text+0x81):
undefined reference to `WinMain@16'

This error doesn't occur when building a C-based Perl
XS module, only a C++ based module.

I put a dummy main() definition in my .xs file

#ifdef __CYGWIN__
int main(int, char**) {}
#endif

which made the shared object link successfully.

Finally, the third and still unsolved problem shows up
when I try to use the module. When Perl loads the
module, I get the following (fatal) error:

Can't find 'boot_CdrDao' symbol in
/usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int/auto/CdrDao/CdrDao.dll

I haven't dug very far into this, but I believe that
boot_CdrDao is a function that is supposed to be
generated by the XS compiler to initialize the module.
Apparently it gets generated properly for C-based XS
modules but not for C++-based XS modules on Cygwin. I
suspect that the last two problems are really two
different symptoms of the same problem.

I'd appreciate any help at all in solving this from
the Perl-XS or the Cygwin community. Thanks.

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]