[CLN-list] CLN vs Cygwin [Was: cln compile error]
Alexei Sheplyakov
varg at theor.jinr.ru
Thu Oct 18 13:21:59 CEST 2007
Hello!
On Tue, Oct 16, 2007 at 08:05:43PM -0500, cbouchrd at uiuc.edu wrote:
> >Do you have the same problem when compiling static library only? i.e.
> >make clean &&./configure --disable-shared && make
>
> Yes. I've now compiled both ways and the on screen indications are identical.
Could you please try this patch:
[PATCH] zerop(cl_I& const): be more ISO C++ friendly.
CLN's MAYBE_INLINE violates ISO C++, which demands (in 7.1.2.4)
"If a function with external linkage is declared inline in one translation
unit, it shall be declared inline in all translation units in which it
appears; no diagnostic is required."
This results in link errors on non-ELF platforms (MinGW, Cygwin, Darwin).
In particular, cl_I_ring.cc contains the following code:
extern bool zerop (const cl_I& x); // from <cln/integer.h>
inline bool zerop (const cl_I& x) // from cl_I.h
{
return x.word == cl_combine(cl_FN_tag,0);
}
static cl_number_ring_ops<cl_I> I_ops = {
cl_I_p,
equal,
zerop, // ...
Since the address of zerop is taken here, the compiler is forced to emit
zerop function out-of-line. This results in duplicate symbols (which is
an error).
---
src/integer/ring/cl_I_ring.cc | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/src/integer/ring/cl_I_ring.cc b/src/integer/ring/cl_I_ring.cc
index 416738a..fd96c12 100644
--- a/src/integer/ring/cl_I_ring.cc
+++ b/src/integer/ring/cl_I_ring.cc
@@ -13,7 +13,9 @@ CL_PROVIDE(cl_I_ring)
#include "cln/integer.h"
#include "cln/integer_io.h"
+#define zerop inline_zerop
#include "cl_I.h"
+#undef zerop
namespace cln {
@@ -34,10 +36,11 @@ static const _cl_ring_element I_zero (cl_heap_ring* R)
return _cl_ring_element(R, (cl_I)0);
}
+static bool I_zerop (cl_heap_ring* R, const _cl_ring_element& x) __attribute__((flatten));
static bool I_zerop (cl_heap_ring* R, const _cl_ring_element& x)
{
unused R;
- return zerop(The(cl_I)(x));
+ return inline_zerop(The(cl_I)(x));
}
static const _cl_ring_element I_plus (cl_heap_ring* R, const _cl_ring_element& x, const _cl_ring_element& y)
--
1.5.3.2
Best regards,
Alexei
--
All science is either physics or stamp collecting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: Digital signature
Url : http://www.cebix.net/pipermail/cln-list/attachments/20071018/ade0b9a6/attachment.pgp
More information about the CLN-list
mailing list