[lug] Semi-OT: Perl/Cygwin Question

Chan Kar Heng karheng at softhome.net
Tue Mar 16 11:52:55 MST 2004


take a peek at the makefiles that come with XS and see what it tries to do.
does it have specific build instructions for cygwin?

i'm suspecting your problem is most likely related to the build target platform/runtime/somewhere there.
also probably with the shared/dynamic linking.

WinMain at 16() is a windows executable entry point (rather than main() under most normal C programs).
if you have something like this:

#include <stdio>

int main(void){puts("duh");return(0);}

.. compiled in cygwin, it'll compile.

but if you change the target (to say something for windows GUI app), it'll likely look for WinMain() instead and generate link error.

as for seg fault, likely caused by illegal memory access.

i don't know of XS and can't help beyond that.
provided advice based on experience with programming & cygwin.


>I seem to be having a problem that frequently crops up with cygwin when
>compiling C code.  When the makefile goes to link the C libraries together
>(to build the perl module created with XS) I get the error "undefined
>reference to WinMain at 16." In the cygwin faq it suggests putting an empty
>main() function in one of the sources.  See: 
>
>http://cygwin.com/faq/faq_4.html#SEC95 
>
>However, when I use this library in my perl program and try to instantiate
>an object from the library I get a Segmentation Fault (only on cygwin, it
>works perfectly on linux). 
>
>
>Is there any voodoo known to those on this list that will side step the
>need to include the main function (which I'm assuming is some how causing
>the segmentation fault), or is there anyone her who understands the
>linking process better than I do who could suggest.... Something?
>ANYTHING?  PLEASE HELP!!!  
>






More information about the LUG mailing list