On Thu, 11 Mar 2010, Tim Bunce wrote:
> 
> For Heiko's config, NYTProf is very broken without the #undefs
> so I'd like to get those in. Assuming your VS2003 hypothesis is correct,
> is there a macro to detect that compiler? And would using that macro
> to wrap the #undefs be a reasonable solution?

I've verified my "conflicting CRT version" hypothesis now (with VS2008).
The issue is indeed a bug in XSUB.h.  I've added a workaround for that
in r1168.

Note that the problem is not specifically about the VS2003 compiler;
it is about mixing several different C runtime libraries.  The reason
I recommend MinGW if you don't have access to VC6 is that it is also
using MSVCRT.dll as the runtime library.  (MSVCRT.dll is part of
Windows itself and not linked to a particular compiler version, which
is one of the reasons why ActivePerl continues to be compiled with
VC6).
 
> That leaves the t/50-errno.t failures. I'd be happy enough to
> skip the failing tests on that system. Is there some way in perl to
> detect that perl was built with VS2003 and/or the dual libraries?
> If not then I could just skip the tests on windows systems with old
> versions of perl, say <= 5.8.9.

This is again a problem of multiple runtime libraries.  The errno
you are setting in Devel-NYTProf is not the same that any of the
redirected FILE* operations are modifying, so the whole saving/restoring
errno doesn't work in this case.  errno is not covered at all by the
Perl macro redefinition system, so I can't see a way around this.

The problem is not related to older Perl versions; it will happen
even for 5.12 once it is released.  I'm also not convinced that this
problem can only happen on Windows with PERL_IMPLICIT_SYS; it should
trigger on other platforms too if they have difference C compilers
with different runtime libraries.

The best I can think of is that you add a little _set_errno() function
to set errno to a specific value, and then check if this value propagates
back to Perl in the test.  Something like:

BEGIN {
    $! = 1;
    Devel::NYTProf::_set_errno(2);
    return if $! == 2;
    print "1..0 # skipped: module linked against different CRT than Perl 
itself\n";
    exit 0;
}

I'll make a note for myself to look into wrapping errno in the Perl headers
once the 5.12 code freeze is over.

Cheers,
-Jan

-- 
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]

Reply via email to