develooper Front page | perl.perl5.porters | Postings from November 2010

Re: Math::BigInt::FastCalc (was Re: [perl.git] branch blead, updated. v5.13.6-223-g5e4a148)

Thread Previous | Thread Next
From:
Rob May
Date:
November 1, 2010 02:45
Subject:
Re: Math::BigInt::FastCalc (was Re: [perl.git] branch blead, updated. v5.13.6-223-g5e4a148)
Message ID:
AANLkTimy6cYwoUYZjFgwD9ckmec=TAEjUPxAcRO+xC3=@mail.gmail.com
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:
>>
>>>    Fix Math::BigInt::FastCalc build under Win32 with croak_xs_usage().
>>> -----------------------------------------------------------------------
>>>
>>> Summary of changes:
>>>  dist/Math-BigInt-FastCalc/FastCalc.xs |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/dist/Math-BigInt-FastCalc/FastCalc.xs
>>> b/dist/Math-BigInt-FastCalc/FastCalc.xs
>>> index dfff9f4..0d67eb7 100644
>>> --- a/dist/Math-BigInt-FastCalc/FastCalc.xs
>>> +++ b/dist/Math-BigInt-FastCalc/FastCalc.xs
>>> @@ -37,7 +37,7 @@ PROTOTYPES: DISABLE
>>>  BOOT:
>>>  {
>>>     if (items < 4)
>>> -       S_croak_xs_usage(aTHX_ cv, "package, version, base_len, base");
>>> +       croak_xs_usage(aTHX_ cv, "package, version, base_len, base");
>>
>> There is a function S_croak_xs_usage() defined in that code:
>>
>> STATIC void
>> S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
>>
>> Perl_croak_xs_usage isn't available on older perls, and this is a dual
>> life
>> module.
>>
>> 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(...)

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().

If the perl is not recent enough, then Extutils::ParseXS should be
emitting a static version (S_croak_xs_usage) and #define
croak_xs_usage() to S_croak_xs_usage().

There's something funny going on if the linker thinks that
S_croak_xs_usage is an external symbol - it should be local to the
compilation unit.

Rob.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About