[lug] Semi-OT: Perl/Cygwin Question

Tkil tkil at scrye.com
Mon Mar 15 17:48:01 MST 2004

>>>>> "Zichary" == Zichary O Tea <Zichary> writes:

Zichary> When the makefile goes to link the C libraries together (to
Zichary> build the perl module created with XS) I get the error
Zichary> "undefined reference to WinMain at 16." In the cygwin faq it
Zichary> suggests putting an empty main() function in one of the
Zichary> sources.  See:

This should only apply to stand-alone programs.  Perl has its own
"main()" routine, so it shouldn't be necessary -- but your problem is
with dynamic linking, not static linking.

Zichary> I can never get [the perl debugger] to give me a debugger
Zichary> prompt, even when I follow the instructions for "Debugging
Zichary> compile-time statments" here:

Note that they mean "at the time perl compiles your script"; no
relation whatsoever to XS modules.

XS modules are typically built into a shared library, then loaded by
the "DynaLoader" module.

It is unlikely that the perl debugger would help, in any event, as it
seems that there is some sort of problem with loading the library and
doing the relocation at dynamic load time.

You might have better luck with a c source-level debugger (e.g., gdb);
run the entire perl process under that, and it might show you where
things are dying.

You'll also want to make sure that your module isn't using
unix-specific API calls that might not be supported by the cygwin

There are a few other options.  See if you can find a pure perl module
with the same functionality as the XS module (or, at least, the parts
of it you use).

Back when I paid more attention to Perl, it seemed that people
generally had more luck with ActiveState Perl, and the binary modules
you could download from them.  This might be enough to get your friend

You might also try asking on the cygwin list, or on a perl list /
channel.  I never paid too much attention to deep perl vs. cygwin
issues; if I really needed that level of control on a pc, I'd just
install linux.  :)

More information about the LUG mailing list