What does `dll exporting/importing` mean?
I'm very confused with this terminology. I absolutely don't like the word export
in the context of dll. Reason is only because, I don't understand what it is. I don't know where to look for either.
It is used in many occasions.
- Exporting from a DLL
- export table from a shared library
- functions exported by dll.
Can any one please explain. What it means? In any other contexts, how does its meaning change?开发者_运维知识库 What is an export table? Is it like .text/.bss/.data section(s) in PE/ELF file?
Why didn't I ever hear about dll import? If such thing exists. When is it used. If its not too much, a simple example would also be great.
Please clarify and I kindly request everyone to use simple terminology. I'm already confused.
A function is exported from a dll when it is exposed to other programs to used. The export table of a dll is the list of functions which are exposed and the addresses at which they are available. Typically, a dll contains some functions which are exported for public consumption, and other functions which are not exported--they can't be called by other dlls or programs using normal methods, but they can be called internally be the dll.
You don't often talk about "dll import" because dll importing is not a single process. When you link to a dll, every function exported by that dll is made available to your dll, but in order to link to a dll you generally need a .h file that gives you the declarations, and a .lib file that provides the stub pointers for the exported functions. These two things together constitute the dll import. However, it is possible to use dll functions without either of these things by using the LoadLibrary
and GetProcAddress
functions (equivalent to POSIX dlopen
and dlsym
).
精彩评论