Re: Problem with building XS module on AS 1401

[email protected] ("Sisyphus")
Newsgroups perl.xs
Message-ID <D179ECCB3F694629AA45DA1F62702D82@desktop2>
----- Original Message ----- 
From: "Erland Sommarskog" <[email protected]>
To: <[email protected]>
Sent: Tuesday, August 02, 2011 7:55 AM
Subject: Problem with building XS module on AS 1401


>I have a module Win32::SqlServer, which I distribute with binaries for
> ActivePerl. With the release of 5.14, I want to provide binaries for
> this version as well. For x64 it works without problem. However, I have
> trouble with 32-bit Perl. The module builds without errors, but when
> running test scripts, there are messages about bizarre and unknown
> things. Perl may crash or go into an infinite loop. If I try to run a
> script with "perl -d", I get a SEGV on the line "use Win32::SqlServer".
> I narrowed this down to this call in the bootstrap code:
>
>   call_list(PL_scopestack_ix, PL_unitcheckav);
>
> I've also built Perl 5.14.1 from sources for x86, and under this build,
> my module builds and runs without problem.
>
> Right now I'm a little confused on what to try next, but I figured if
> I could ask if there are any known issues.

If you want your binaries to work with 5.14.x (for all values of x) you 
should build them using 5.14.0.
There could conceivably be problems if binaries built using 5.14.1 were to 
be run on 5.14.0 - though I've not experienced anything like the mysterious 
problems you're describing.

If your 32-bit perl, and therefore also your binaries, use a runtime other 
than msvcrt.dll (eg msvcr80.dll), then that also can cause *big* problems - 
in the form of a crash.
ActivePerl uses the msvcrt.dll runtime, and  that runtime won't know what to 
make of any handles passed to it that were created by a different runtime.
If that's happening with your 32-bit builds, then the only solution I know 
of is to use a compiler (and a perl) that *does* use the msvcrt.dll 
runtime - eg MSVC++ 6.0 or MinGW (and a perl built with the same).

If that is the problem, I would also think you would then get the same issue 
with earlier versions of ActivePerl. Did that happen ?

Does the problem arise only when you use *ActivePerl* with your compiler to 
build your module ?
Do you get a similar problem if you take the binaries that tested fine on 
*your* build of perl-5.14.1, and use them with ActivePerl-5.14.1 ?

> Revelant information may be that I've build my module on an x64 machine,
> using the C++ compiler from either VS2005 or VS2010. (The module does
> not compile with earlier versions.)

I've built quite a few binaries on an x64 machine for both 32-bit and 64-bit 
ActivePerls and haven't struck any problems of the type you describe.

Jan Dubois possibly has some ideas (and definitely has a better 
understanding) about this. If he doesn't turn up here, and you wish to get 
some feedback from him, try posting to the perl-win32-users list hosted by 
ActiveState - he seems to keep a close eye on that list.

Cheers,
Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.