I am attempting to compile the Algorithm::SVM package on Win32. It's a wrapper for the LIBSVM library written using XS. It works wonderfully on gnu/linux, but when trying to link using g++ with cygwin or the mingw g++ I get a linker error along the lines of "undefined reference to _WinMain@16".
As suggested in the Cygwin FAQ I added an empty main function (int main() {return 0;}) to the sources, and everything compiled and linked. However, I think this introduced an "error" in to the resulting DLL. When attempting to load the library (i.e. the line use Algorithm::SVM) in my perl program, I get a segmentation fault.
Tracing the the execution in to the use Algorithm::SVM statment, I discovered that (using both the cygwin perl, and activestate perl), the segmentation fault occurs when executing the line &$xs(@args) in DynaLoader.pm.
My best guess is that adding the main function had some how corrupted the way the library is supposed to work. I have been attempting to compile the library with Visual C++ 6, and BCC 5.5, but it's turning out to be an arduous process, and I'm not sure if it will/can be successful. Not to mention that I would rather use free tools, if possible.
Is this a common problem when trying to get XS modules to work on windows? How is it usually corrected?
In reply to Compiling XS Libraries Suitable for DynaLoader on Win32 by torezodu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |