3 ms·
I can think of using libraries, that get their config through environment variables. So you start your program, modify environment, and then start up the rest.
by okr 3y ago
I can think of using libraries, that get their config through environment variables. So you start your program, modify environment, and then start up the rest.
- quickthrower2 3y agoDoes the “and then” protect you here?
- okr 3y agoNo, not really. You never know when the library reads the enviroment variables. But i can make sure, that the parts under my control do not modify them after start.
- johanbcn 3y agoLibraries shouldn't be reading environment variables, that responsibility should be only for the application.
- kuon 3y agoIt is common, out of my head SDL and pipewire do it.
- lelanthran 3y agoThey shouldn't, but if even the C standard library reads environment variables, then the bar is set pretty low for library designers. 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.