Subject: Re: Problems with Perl XS module in C++ on Cygwin
From: "Gerrit P. Haase" <[email-masked]>
To: Eric Benson <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 4 Nov 2002 07:26:33 +0100

Hallo Eric,

Am Dienstag, 1. Oktober 2002 um 20:06 schriebst du:

> 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.

Sorry for replying that late.  Have you tried to build your
module with GCC 3 which is now stable and recommended as
Compiler.  It supports C++ coding much better.
Available through the usual Cygwin mirrors with setup.exe.

Gerrit
-- 
=^..^=

--
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/