----- Original Message -----
From: "Nick Ing-Simmons" <[EMAIL PROTECTED]>
> >I don't understand the error message
>
> You can only initialize static arrays to things which can be resolved
> at link time (in C89 anyway).
>
I'll check with the gcc list to see if this has changed with later releases
of gcc.
> My guess is that 'mpz_add' has been #defined to something like
>
> (*FunctionTablePtr->MPXADD)
>
> which is a common trick with dynamicaly loaded code.
>
> Try just preprocessing the file (dmake GMP.i might work for this??)
>
D:\gmp-4.1\demos\perl>dmake gmp.i
dmake.exe: Error -- Don't know how to make `gmp.i'
Is that what you meant ?
>
> MSVC++ is at heart a C++ compiler - and that kind of thing is legal in
C++
> (for construtors etc.) so its 'C' allows it too.
>
> You _may_ be able to work-round the problem by using g++ to pretend
> your code is C++
>
Yes, I posted to the GMP list as well, and received similar advice. To
quote - "Hmm, yep, DLL imported functions don't work in initializers" (with
gcc). Another option mentioned was to try with a statically-built GMP.
So, with a fresh slate, I ran 'perl makefile.pl' and edited the generated
makefile to specify 'CC = g++'. That had the desired effect of invoking g++
instead of gcc, but unfortunately led to parse errors:
GMP.xs:294: parse error before `{'
GMP.xs: In function `void class_or_croak(...)':
GMP.xs:295: parse error before `,'
GMP.xs:296: parse error before `;'
dmake.exe: Error code 1, while making 'GMP.o'
where the relevant code (starting at line 292) is:
static void
class_or_croak (SV *sv, classconst char *class)
{
if (! sv_derived_from (sv, class))
croak("not type %s", class);
}
I might just use the msvc-built binaries in my gcc-built perl.
My reluctance in doing so is that my msvc compiler is non-optimising. Given
that GMP dll *was* built with an optimising compiler, it may well be
insignificant whether or not the actual perl module gets built with an
*optimising* compiler. (Anyone have any thoughts on that aspect ?)
One further question:
Since gcc, or g++, as the case maybe, is compiling GMP.c (afaik), why is it
that the errors are being reported in GMP.xs (not the file that's actually
being compiled) ?
I'm sure that I have, in building other modules, received errors pertaining
to both xs and c files (mostly the xs file, but sometimes the c file) - but
I'm just wondering what it is that determines whether the error is going to
be reported as being in the xs file or the c file.
Thanks Nick.
Cheers,
Rob