bug-gnulib
[Top][All Lists]
Advanced

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

Re: random module linking problem on mingw ?


From: Bruno Haible
Subject: Re: random module linking problem on mingw ?
Date: Sun, 16 Dec 2018 16:29:02 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-139-generic; KDE/5.18.0; x86_64; ; )

Hi Assaf,

> The attached patch works for me on mingw,

Thanks for the investigation.

For me, with a gnulib testdir created through
  ./gnulib-tool --create-testdir --dir=../testdir1 --single-configure random
I still get a link error in test-random. "nm" shows why: random.o defines
__initstate and __setstate, where test-random.c expects initstate and setstate.
But it is easy to fix, now that you have shown how.

I've pushed the combined fix in your name:


2018-12-16  Assaf Gordon  <address@hidden>

        random: Fix build error on native Windows (regression from 2018-06-21).
        * lib/random.c (__srandom, __initstate, __setstate, __random,
        __srandom_r, __initstate_r, __setstate_r, __random_r) [!_LIBC]: Redirect
        to the symbols without '__' prefix.

diff --git a/lib/random.c b/lib/random.c
index d14b820..5e01b72 100644
--- a/lib/random.c
+++ b/lib/random.c
@@ -52,6 +52,14 @@
 
 #ifndef _LIBC
 # include <libc-config.h>
+# define __srandom srandom
+# define __initstate initstate
+# define __setstate setstate
+# define __random random
+# define __srandom_r srandom_r
+# define __initstate_r initstate_r
+# define __setstate_r setstate_r
+# define __random_r random_r
 #endif
 
 /* Specification.  */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]