开发者

What does "a module statically or dynamically binds to the shared library" mean?

开发者 https://www.devze.com 2023-02-19 22:26 出处:网络
Quoted from a reply to a post 3.The calling module will then either statically or dynamically bind to the

Quoted from a reply to a post

3.The calling module will then either statically or dynamically bind to the shared library.

4.Once your calling library is bound to the shared library it can then specify it wants to bind to a particular entry point. This is generally done by name, however most platforms also offer the option of bi开发者_开发问答nding by index (faster, yet more brittle if your module changes and entry points are reordered).

5.You will also generally declare the function you want to call in your module somewhere so that your language can do static type checking, knows what the calling convention is etc.

I was wondering

  1. what does "a module statically or dynamically binds to the shared library" mean? Does it mean name binding, i.e. association of identity in some module to objects (code or data) in the shared library, or linking from some module to the share library?
  2. Where I can find a more wikipedia-like description on binding by name and by index?

Thanks and regards!


Dynamic and static linking are methods of sharing library code in modern computer operating systems.

Dynamic linking happens at runtime. It trades a little bit of extra work at startup time for some nice features like allowing the library to be patched/replaced which in turn can fix or add features to applications which are linked (bound) to it.

Static linking is where portions of the library are copied into the executable. This is faster for startup and sometimes more convenient for distribution because you don't have to worry about whether the recipient has all the shared libraries. It can also save space in some cases. It's common for embedded applications.

http://en.wikipedia.org/wiki/Dynamic-link_library http://en.wikipedia.org/wiki/Static_library

The binding by name refers to the process of linking functions, variables, and constants from a library into an application, module of an application, or another library. Basically a library is an archive of code and there's a table which points to each compiled bit of code's location in the library, and the linker uses the names to look up where the bits are that are needed. Like a phonebook =)

Binding and Linking are used interchangeably in a lot of contexts.

Think of it this way: Binding by name the reference remains by name, lookups will have to search some sort of namespace to resolve accesses. With linking the name is converted into an address, generally just the one time, and then the name is no longer required. Linking is fast for multiple accesses.

Some binding systems may implement an address cache to speed up lookups. A good example is your desktop's ARP cache, which caches IP addresses which were looked up by name using a DNS server (coincidentally, the most-used DNS server is called "bind".)

Scripting languages often bind things by name instead of linking, because the overhead of doing name-based lookups isn't as big a penalty when the language itself is interpreted.


Binding means loading and getting an address for the shared library. Normally, the program will be make a reference to the shared library at compiled time, this called static binding.

A dynamic bind is when the program determines at run-time the name of shared library and loads it then

0

精彩评论

暂无评论...
验证码 换一张
取 消