Libraries shouldn't be reading environment variables, that responsibility should be only for the application.
Look up the mess around LOCALE sometime.
The best the programmer can do is perform all the setenv calls before spawning any threads or making any library calls.