On Windows this can be done (though not recommended since pass c standard library object between different c library instances can have problem), like this:
Every executable image (EXE or DLL) can have its own statically linked CRT, or can dynamically link to a CRT. The version of the CRT statically included in or dynamically loaded by a particular image depends on the version of the tools and libraries it was built with. A single process may load multiple EXE and DLL images, each with its own CRT
Can this be done on Linux?
Does this mean false? But a general system like Linux should not have such restrictions right? For example, what if codebase A and codebase B really need different version of libc to work well and suppose they both have very simple C style API for the clients (i.e. no pointer parameter in those APIs)?
If it is not possible, then there is no need to read the following.
As a first step toward this goal, when I tried to build a shared library with static linked libc:
g++ -fPIC -Wall -fexceptions -g -c main.cpp -o main.o
g++ -shared -static main.o -o libtestCppSharedLib.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/7/crtbeginT.o: relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status