Re: Dynamic linking library
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
Suppose there are two executable elf . say A, B . And these two are using libctest.so. When A is executed libctest.so is loaded into RAM and linear address is correctly mapped. If we execute program B after A , will library will be loaded again ?
When A is executed dynamic loader opens the library and then mmap(2)s it into virtual address space. When B is executed, from user space (ie. dynamic loader) point of view the very same thing happens: dynamic loader opens the library and mmap(2)s it into virtual address space. What happens behind the scene, is that when the libctest.so is opened, file system figures out it's inode and then opens file with given inode number. The first time this is done, system creates all bunch of structures forthe file, however, the second time, system sees that a file with given inode number is already opened so some data can be shared between the two instances.
-- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html