Some APIs require the use of setenv. For example, you need to setenv("TZ", ...) if you want to use multiple timezones.
You mean linked libraries you don't have the source of? Yes, in that case set the environment vars as early as possible (if possible before starting any thread).