Quote:
Originally Posted by sathyadurai
a design which requires complete modularity and speed.
|
Why does it require modularity and/or what do you mean by "modularity".
Any big software project ought to be modular in its structure of source files. Modularity in the build sequence and dependencies is also likely a good idea. But none of that requires shared libraries.
Shared libraries might support modularity in the distribution process, but that generally doesn't work very well nor save enough to be worth the trouble.
The modularity of shared libraries is much more important when multiple executables need the same functions.
So what purpose / kind of modularity do you actually require?
There is some tradeoff vs. speed. Code in a .so can be noticeably slower than the same code in the main executable. Usually that is not a significant factor, but since you mentioned speed, you should be aware that there might be an issue.
Quote:
I'm just worried how to go about the no of shared libraries? for example can i have 10 shared libraries in place of 1? what will be the advantage in that case?
|
The run time disadvantages of ten .so's in place of one are generally smaller than the already small disadvantages of .so's in place of linking directly into the main executable. I don't think you want to worry about those disadvantages.
But why ask us what the advantages are? That totally depends on what you are doing. There is no generic advantage to .so at all and certainly no generic advantage to more .so files vs. fewer. The specific advantages depend on your situation:
Are you distributing updates through some limited or low speed channel and also updating different parts of the project on different schedules?
Are you creating several different executables that each need a different subset of a library of shared functions?
Those are the kind of issues that might push someone toward using a larger number of smaller .so files.
Quote:
Originally Posted by tronayne
libraries are most useful when more than one program or more than one instance of a particular program is going to be executing at the same time
|
I think the advantage for shared libraries for more than one
instance of a program is an obsolete concept. The main program image should be just as shareable between multiple instances as the shared libraries. The loader maps most of the main image into the virtual address space rather than reading it into anonymous memory. Like any other mapping of a file into memory, resident pages will be shared by any other process that maps the same file and has the same pages resident.
Shared libraries are most useful when more than one program (not instances of one program) uses the same functions.