On Mon, Nov 01, 2010 at 09:52:13AM +0000, Rob May wrote:
> On 1 November 2010 09:45, Rob May <rob@themayfamily.me.uk> wrote:
> > On 31 October 2010 02:20, George Greer <perl@greerga.m-l.org> wrote:
> >> On Sat, 30 Oct 2010, Nicholas Clark wrote:
> >>
> >>> On Sat, Oct 30, 2010 at 02:40:36AM +0200, George Greer wrote:
> >>> What was the actual build error?
> >>
> >> FastCalc.xs(40) : warning C4013: 'S_croak_xs_usage' undefined; assuming
> >> extern returning int
> >> FastCalc.obj : error LNK2019: unresolved external symbol _S_croak_xs_usage
> >> referenced in function _boot_Math__BigInt__FastCalc
> >> ..\..\lib\auto\Math\BigInt\FastCalc\FastCalc.dll : fatal error LNK1120: 1
> >> unresolved externals
> >>
> >> Possibly because PERL_ARGS_ASSERT_CROAK_XS_USAGE is defined in proto.h so
> >> the "#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE" from FastCalc.c (FastCalc.xs)
> >> prevents the function from existing at all. Nothing else in dist/ tries to
> >> use S_croak_xs_usage so it wouldn't have been seen yet.
> >>
> >>> Really, the code should continue to use the static function, else it's not
> >>> going to work as a dual life module with older perls.
> >>
> >> Ah, yes that would be bad.
> >
> > I haven't looked at the Math::BigInt::FastCalc code, but it should be
> > calling croak_xs_usage(...)
>
> Sorry - it's Extutils::ParseXS that emits the code calling croak_xs_usage().
>
> Can you post the generated FastCalc.c for me to take a look at?
Sorry for the delay
> > If the perl is recent enough to define PERL_ARGS_ASSERT_CROAK_XS_USAGE
> > then the standard perl headers should #define croak_xs_usage() to the
> > perl exported function Perl_croak_xs_usage().
Aha. I was misreading this:
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
STATIC void
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
{
...
as
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
#endif
/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
STATIC void
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
{
...
ie that there was always a static function.
So, I ask myself - how come it even worked on Unix in the first place.
Answer - the core runs tests roughly like this:
$ ./perl -Ilib -e 'require Math::BigInt::FastCalc'
CPAN modules (on Unix) run like this:
$ PERL_DL_NONLAZY=1 ./perl -Ilib -e 'require Math::BigInt::FastCalc'
Can't load 'lib/auto/Math/BigInt/FastCalc/FastCalc.so' for module Math::BigInt::FastCalc: lib/auto/Math/BigInt/FastCalc/FastCalc.so: undefined symbol: S_croak_xs_usage at lib/XSLoader.pm line 71.
at lib/Math/BigInt/FastCalc.pm line 45
Compilation failed in require at -e line 1.
Or not. :-)
And you get to see that there is a problem.
So it passed, because none of the tests ever exercise the new "you can't get
here" code path that I added. I guess that I could blame myself for that :-)
Nicholas Clark
Thread Previous
|
Thread Next