Bill Allombert on Fri, 18 Jun 2004 20:42:54 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

mangled C++ symbol in mpinl.o

Hello PARI-dev,

We have made change to subii et al. to avoid constructs like:
long s=signe(s);
setsigne(y,-s) z=addii(x,y); setsigne(y,s)
return z;

which are unsafe: if y is a clone and GP is interupted (e.g. via ^C)
during addii, we end up with a changed y.

The patch has the side-effect to exercise a bug in our header files:
mpinl.o contains mangled symbol when compiled with a C++ compiler.
We need to add some BEGINEXTERN/ENDEXTERN macro.
kernel.o has the same problem with the portable kernel. In the ix86
kernel it is written in assembly so is not mangled.

Because of this bug, addii is mangled and install(addii,GG) fail
when compiled with a C++ compiler.

The patch below fix that for all kernel and architectures at once.

The only problem I foresee is with broken C++ compilers that would
frown on constructs like
extern "C" {
  extern "C" {

But that can probably be fixed, and I am not sure such compiler could
compile PARI anyway.


diff -u -r1.3 pari.h
--- src/headers/pari.h  5 Feb 2003 16:24:22 -0000       1.3
+++ src/headers/pari.h  18 Jun 2004 18:21:35 -0000
@@ -84,5 +84,7 @@

 #include "pariport.h"
 #include "pariinl.h"