.SO Dynamic Linking

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

.SO Dynamic Linking

Post by Jeko »

How can I use dynamic linking with .SO libraries and ELF binaries?
User avatar
Telgin
Member
Member
Posts: 72
Joined: Thu Dec 20, 2007 1:45 pm

Post by Telgin »

Well, do you mean for linking applications at run time for your OS?

I haven't gotten that far by a long shot, but for ELF I'm pretty sure it goes something along the lines of this:

I believe that the ELF headers contain a list of functions that are exported from the dynamic library, then the application that requires the library has information in its header that lists the functions required. You would then load the required dynamic library into memory and "link" it together by copying the address of the exported functions into their required locations in the application.

For the specifcs, I'm afraid you're going to have to look up the ELF specification, it's going to tell you all of the details. Even then, it's going to depend on your OS.

On the other hand, if you're talking about using dynamic libraries in your kernel and you want to know how to do something like pass this information to the linker utility, then I have no clue. Generally I guess that would require the above functionality for the kernel anyway.
User avatar
Jeko
Member
Member
Posts: 500
Joined: Fri Mar 17, 2006 12:00 am
Location: Napoli, Italy

Post by Jeko »

Telgin wrote:Well, do you mean for linking applications at run time for your OS?

I haven't gotten that far by a long shot, but for ELF I'm pretty sure it goes something along the lines of this:

I believe that the ELF headers contain a list of functions that are exported from the dynamic library, then the application that requires the library has information in its header that lists the functions required. You would then load the required dynamic library into memory and "link" it together by copying the address of the exported functions into their required locations in the application.

For the specifcs, I'm afraid you're going to have to look up the ELF specification, it's going to tell you all of the details. Even then, it's going to depend on your OS.

On the other hand, if you're talking about using dynamic libraries in your kernel and you want to know how to do something like pass this information to the linker utility, then I have no clue. Generally I guess that would require the above functionality for the kernel anyway.
I need to know the second thing
cyr1x
Member
Member
Posts: 207
Joined: Tue Aug 21, 2007 1:41 am
Location: Germany

Post by cyr1x »

This should be a good explaination.
Post Reply