rawRead linker error
Joseph Rushton Wakeling via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 1 10:04:23 PDT 2014
Hello all,
I'm trying to read from /dev/random using File.rawRead as follows:
auto f = File("/dev/urandom", "r");
ulong b;
f.rawRead((&b)[0 .. 1]);
writeln(b);
This generates a linker error:
rawread.o: In function `_D3std5stdio4File14__T7rawReadTmZ7rawReadMFAmZAm':
rawread.d:(.text._D3std5stdio4File14__T7rawReadTmZ7rawReadMFAmZAm+0xba):
undefined reference to
`_D3std9exception88__T12errnoEnforceTbVAyaa27_2f6f70742f646d642f696d706f72742f7374642f737464696f2e64Vmi715Z12errnoEnforceFNfbLAyaZb'
collect2: error: ld returned 1 exit status
--- errorlevel 1
Can anyone advise what's the problem here? Passing a regular array as the
buffer doesn't cause any issues, but I can't see what's wrong with passing a
slice based around pointer-to-ulong as in the above example.
This certainly _used_ to work, so I take it it's down to a recent change to
rawRead ... ?
Thanks and best wishes,
-- Joe
More information about the Digitalmars-d-learn
mailing list