public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Some questions about adding mingw support for std::random_device
@ 2012-12-28  8:05 niXman
  2012-12-28 14:12 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: niXman @ 2012-12-28  8:05 UTC (permalink / raw)
  To: gcc-help

Hi,

I want to add mingw support for std::random_device and I have a few questions.

1) When configuring libstdc++, the GLIBCXX_CHECK_RANDOM_TR1 test
passes successfully, because MSYS is used. But the compiler and the
programs created by it can not use '/dev/urandom' || '/dev/random',
because they do not use MSYS-runtime. The first question is, do I need
to change the GLIBCXX_CHECK_RANDOM_TR1 test itself so that for mingw
it would be not successful, or I have to add in the file
'libstdc++-v3/include/bits/random.h' an additional checking by the
preprocessor and ignore the value of _GLIBCXX_USE_RANDOM_TR1 macro? I
think the first variant is more logical because the second variant
seems to be some cleaning up.
2) Since the I'm very new in autotools, tell me please, how should I
change the GLIBCXX_CHECK_RANDOM_TR1 test?

Thanks.

-- 
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Some questions about adding mingw support for std::random_device
  2012-12-28  8:05 Some questions about adding mingw support for std::random_device niXman
@ 2012-12-28 14:12 ` Jonathan Wakely
  2013-01-05 13:25   ` niXman
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2012-12-28 14:12 UTC (permalink / raw)
  To: niXman; +Cc: gcc-help

On 28 December 2012 08:05, niXman wrote:
> Hi,
>
> I want to add mingw support for std::random_device and I have a few questions.
>
> 1) When configuring libstdc++, the GLIBCXX_CHECK_RANDOM_TR1 test
> passes successfully, because MSYS is used. But the compiler and the
> programs created by it can not use '/dev/urandom' || '/dev/random',
> because they do not use MSYS-runtime.

As I know nothing about MSYS I don't understand this. Why do the files
exist but can't be used?
Do you mean the files are present on the system where GCC is built,
but not on the system where compiled programs run?

> The first question is, do I need
> to change the GLIBCXX_CHECK_RANDOM_TR1 test itself so that for mingw
> it would be not successful, or I have to add in the file
> 'libstdc++-v3/include/bits/random.h' an additional checking by the
> preprocessor and ignore the value of _GLIBCXX_USE_RANDOM_TR1 macro? I
> think the first variant is more logical because the second variant
> seems to be some cleaning up.

Fixing the test would be better, but if it's not possible to tell
whether the files are usable until runtime then no preprocessor test
can work.

> 2) Since the I'm very new in autotools, tell me please, how should I
> change the GLIBCXX_CHECK_RANDOM_TR1 test?

Change the acinclude.m4 file, then regenerate the other files by
running autoreconf. You'll need the right version of autoconf, which
is 2.64

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Some questions about adding mingw support for std::random_device
  2012-12-28 14:12 ` Jonathan Wakely
@ 2013-01-05 13:25   ` niXman
  2013-01-05 15:35     ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: niXman @ 2013-01-05 13:25 UTC (permalink / raw)
  To: Jonathan Wakely, gcc-help

2012/12/28 Jonathan Wakely:
> Do you mean the files are present on the system where GCC is built,
> but not on the system where compiled programs run?
Yes, these files are not available not only where executed program
built with Mingw, but where Mingw used.
Mingw - native windows program. MSYS - POSIX environment emulator.

> Fixing the test would be better, but if it's not possible to tell
> whether the files are usable until runtime then no preprocessor test
> can work.
For Mingw not need to check '/dev/random' or/and '/dev/urandom' are
available or not. It would be correct to say that these files are
always not available.


-- 
Regards,
niXman
___________________________________________________
Dual-target(32 & 64-bit) MinGW compilers for 32 and 64-bit Windows:
http://sourceforge.net/projects/mingwbuilds/
___________________________________________________
Another online IDE: http://liveworkspace.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Some questions about adding mingw support for std::random_device
  2013-01-05 13:25   ` niXman
@ 2013-01-05 15:35     ` Jonathan Wakely
  2013-01-05 18:51       ` NightStrike
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2013-01-05 15:35 UTC (permalink / raw)
  To: niXman; +Cc: gcc-help

On 5 January 2013 12:14, niXman wrote:
> 2012/12/28 Jonathan Wakely:
>> Do you mean the files are present on the system where GCC is built,
>> but not on the system where compiled programs run?
> Yes, these files are not available not only where executed program
> built with Mingw, but where Mingw used.
> Mingw - native windows program. MSYS - POSIX environment emulator.
>
>> Fixing the test would be better, but if it's not possible to tell
>> whether the files are usable until runtime then no preprocessor test
>> can work.
> For Mingw not need to check '/dev/random' or/and '/dev/urandom' are
> available or not. It would be correct to say that these files are
> always not available.

In that case a quick fix would be to #undef _GLIBCXX_USE_RANDOM_TR1 in
config/os/mingw32*/os_defines.h

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Some questions about adding mingw support for std::random_device
  2013-01-05 15:35     ` Jonathan Wakely
@ 2013-01-05 18:51       ` NightStrike
  0 siblings, 0 replies; 5+ messages in thread
From: NightStrike @ 2013-01-05 18:51 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: niXman, gcc-help

On Sat, Jan 5, 2013 at 3:25 AM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 5 January 2013 12:14, niXman wrote:
>> 2012/12/28 Jonathan Wakely:
>>> Do you mean the files are present on the system where GCC is built,
>>> but not on the system where compiled programs run?
>> Yes, these files are not available not only where executed program
>> built with Mingw, but where Mingw used.
>> Mingw - native windows program. MSYS - POSIX environment emulator.
>>
>>> Fixing the test would be better, but if it's not possible to tell
>>> whether the files are usable until runtime then no preprocessor test
>>> can work.
>> For Mingw not need to check '/dev/random' or/and '/dev/urandom' are
>> available or not. It would be correct to say that these files are
>> always not available.
>
> In that case a quick fix would be to #undef _GLIBCXX_USE_RANDOM_TR1 in
> config/os/mingw32*/os_defines.h

Windows has the CryptGenRandom() API to get a random number.  Reading
\Device\KsecDD directly doesn't work, AFAIK

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-05 15:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-28  8:05 Some questions about adding mingw support for std::random_device niXman
2012-12-28 14:12 ` Jonathan Wakely
2013-01-05 13:25   ` niXman
2013-01-05 15:35     ` Jonathan Wakely
2013-01-05 18:51       ` NightStrike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).