|go ahead... be a heretic|
errno in XS not propagating to $! - breaks Net::SSLeayby nobull (Friar)
|on Feb 14, 2008 at 16:32 UTC||Need Help??|
nobull has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to install Net::SSLeay.
It is failing to test correctly and I've traced the problem to the following.
Where constant is defined in C as
The problem is that setting errno within the XS code is not propagated to the Perl $! variable.
The build process does keep warning me...
*** Be sure to use the same compiler and options to compile your OpenSSL, perl, and Net::SSLeay. Mixing and matching compilers is not supported.
I guess I shouldn't have ignored that warning. Or rather I shouldn't have thought it meant I should mix GCC v Microsoft v Intel compilers.
My Perl build is a binary from ActiveState, v5.8.8 MSWin32-x86-multi-thread build 820. This was built using the Microsoft compiler. My compiler is Microsoft 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86. I'm guessing these are sufficiently "different" that the errno symbol ends up bound to different variables in auto/Net/SSLeay.dll from it is in perl58.dll. My OpenSSL is a binary download from somewhere.
I've noticed that a lot of people (not just Perl users) seem to use Windows, and many of them download programs/libraries as compiled binaries rather than source. (Indeed I've even noticed that Windows doesn't install the C compiler be default). So how do people get away with such reckless behaviour if Microsoft's compilers are so grossly incompatible between versions?
I've hacked the code of Net::SSLeay so that it doesn't attempt to pass information from the XS code to the Perl via errno and if I get it working I may submit a patch but I can't help wondering if I'm doing the wrong thing.