开发者

Why winpcap requires both .lib and .dll to run?

Specifications can be seen here:

http://www.winpcap.org/开发者_JS百科docs/docs_40_2/html/group__wpcapsamps.html

It's very strange,either .lib or .dll is enough IMO,why does it require both?


In general, you need the .lib for the linker, and .dll at runtime. The .lib file is called an "import library", which contains the glue that tells the linker the functions you're calling can be found in the associated .dll file.

You will probably find that only the .dll file is required at runtime.

This is a widely used layout for Win32 DLL projects and is not limited to Winpcap.


Its not only with winpcap, all external libraries are like that.

  • When you compiles your source codes which using particular library, you need header files *.h from that library, and you will get *.o files
  • When you link those *.o files to executables, you will need *.lib or *.dll.a files.
  • When you run those executable files, you will need *.dll files


If you are calling a Dll you will need an Lib with that. you can see the below link for more info

This is from wikipedia

Linking to dynamic libraries is usually handled by linking to an import library (your .LIB) when building or linking to create an executable file. The created executable then contains an import address table (IAT) by which all DLL function calls are referenced (each referenced DLL function contains its own entry in the IAT). At run-time, the IAT is filled with appropriate addresses that point directly to a function in the separately-loaded DLL.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜