Earnie Boyd wrote, quoting me:
>> You can always write your own implementation, calling it, say,
>> my_setlocale(). Then, "#define setlocale my_setlocale", and any
>> subsequent calls to setlocale will be redirected to your
>> implementation, rather than to the MSVCRT implementation.
> You should even be able to call your implementation setlocale and use
> it since the reference is satisfied before looking in the library to
> resolve the difference. Keith's method though ensures that it will
> always use your implementation.
Indeed; but there's another advantage to my method.
I based my earlier advice on code I've actually used, to work around the
broken argument passing in the MSVCRT implementation of spawn???(),
where my_spawn???() preparses and reassembles the argument vector,
grouping arguments within double quotes where necessary, and then calls
the original MSVCRT spawn???() function, passing it the modified
argument vector. This is possible because I DON'T
#define spawn???() my_spawn???()
within the implementation of my_spawn???(), but I DO #define it
everywhere I want to use spawn???(). This way I can use any of the
spawn???() functions, and argument passing will work correctly, but I
didn't have to rewrite a full implementation from scratch. That sort of
synergy could not be realised, had I kept the MSVCRT function names for
my replacement -- or rather, wrapper -- functions.