about summary refs log tree commit diff
path: root/src/libhexfloat
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-12 09:12:04 -0700
committerbors <bors@rust-lang.org>2014-05-12 09:12:04 -0700
commite8053b9a7ff91b6a69238c1d7dea99be34bb7a3b (patch)
treed5ab9f71437bebfc7a8d01b1ee50bb218e75f8cf /src/libhexfloat
parentedae0bdabf75b6acf4f0f0eb5bc2bd3b29d58b81 (diff)
parentfacd1270c636beb7c2c8153424ffd6dda4179d59 (diff)
downloadrust-e8053b9a7ff91b6a69238c1d7dea99be34bb7a3b.tar.gz
rust-e8053b9a7ff91b6a69238c1d7dea99be34bb7a3b.zip
auto merge of #13932 : MrAlert/rust/win-compat, r=brson
This addresses #12842 by offering fallback implementations for functions that aren't available.

In this case, as Windows XP simply doesn't support symbolic links at all, the fallbacks simply return an error code indicating that the function hasn't been implemented. This should allow programs written in Rust to run under XP while still offering full support for symbolic links under newer versions of Windows with the same binary, but due to LLVM using stderror_s(), which isn't available in msvcrt.dll in XP, rustc itself will not.

The fallback implementation is as follows:

Calling the function instead calls to a mutable function pointer. This in and of itself would not constitute a performance hit because DLL calls are implemented in a similar manner (see Import Address Table). The function pointer initially points to a thunk which tries to get the address of the associated function and write it back to the function pointer. If it fails to find the function, it instead writes the address to a fallback. As this operation is idempotent, reading and writing the pointer simply needs to be atomic. Subsequent calls to the function should be as fast as any other DLL call, as the pointer will then point directly to either the correct function or a fallback.
Diffstat (limited to 'src/libhexfloat')
0 files changed, 0 insertions, 0 deletions