Is it possible to link lib dynamically, as with a DLL?

This is an interview question.

Is it possible to link lib dynamically, like a DLL?

For example, for a DLL we use LoadLibrary and call the exported functions. Is it possible to use the lib file in the same way?

+3
source share
4 answers

No. .liblibrary statically linked and it is the goal to resolve symbol names link-time Linker , and his exile to the execution time . They are often called "static libraries" (so I added this tag to your question!). This is a short lib story.

DLL, .

+5

. DLL , , .lib DLL-.

+2

. . DLL - PE32 , . LIB - OBJ.

, , , DLL , . , .LIB , .

, , ​​DLL. DLL, , ++ . , .

. .LIB, . , , malloc-stlye, , EXPORT. , EXPORT, .

+1
source

Yes - not directly, but with very little work.

Create a new .DLL project, connect the .lib, determine which functions you want to export in the .DEF file, and then compile.

0
source

Source: https://habr.com/ru/post/1789964/


All Articles