3 ms·
> for example some library can only be configured via env variables library has already loaded when you call setenv, so what you're saying doesn't work in most
by guappa 3y ago
> for example some library can only be configured via env variables
library has already loaded when you call setenv, so what you're saying doesn't work in most cases.
It seems to be a need to use poorly written libraries. You might consider fixing them instead.
- jonhohle 3y agoI agree that would be a poor implementation, but the library could be loaded at runtime using dlopen or equivalent. This issue with that “interface” is the environment is process global. If the library is being loaded dynamically (specifically for some task) it would seem that the parameters are local to that task and should be taken by some reentrent init method. Alternatively, the process could be forked and environment set in the child without concern for thread safety or polluting the environment (think of the children!).
- guappa 3y agoThe only library I've seen to use env vars is libc, which uses them to decide how malloc should behave for example.
- the_svd_doctor 3y agoSome libraries behaviour/API can be tweaked with env var. env var are read at runtime not loading time.
- guappa 3y agoCan you link one such library here?