I have two dynamically loadable libraries lib_smtp.so and and libpop.so etc. Both have a global variable named protocol
which is initialized to "SMTP" and "POP" respectively. I have another static library libhttp.a where protocol
is initialized to "HTTP".
Now for some reason i need to compile all dynamic linkable and loadable libraries statically and include in the executable. Doing so i am getting error "multiple definition of symbol" during linking of static libraries.
I am curious to know how linker resolves duplicate symbols during dynamic linking where all three mentioned libraries are getting linked ?
Is there some way i can do the same statically as linker is doing in dynamic linking ie without any conflict add all static libraries to executable which have same symbols? if not, why the process is different for statically linked libraries.