# Questions about importing library file xxx.dll.a when generating dynamic library in window environment

**URL:** https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015
**Category:** Usage
**Tags:** os:windows
**Created:** [September 20, 2023, 3:08am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015 "2023-09-20T03:08:19Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![xhc-code](https://discourse.cmake.org/user_avatar/discourse.cmake.org/xhc-code/32/3842_2.png) [@xhc-code](https://discourse.cmake.org/u/xhc-code)
#### Post date: [September 20, 2023, 3:08am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015/1 "2023-09-20T03:08:19Z")

</div>

In the window environment, when gcc generates the share dynamic dll library, it is always accompanied by the file xxx.dll.a. I searched and learned that this file is an import library, but I cannot find the function and usage of this file. Does anyone know the function? Boss?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [September 20, 2023, 6:50am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015/2 "2023-09-20T06:50:37Z")

</div>

This file is used when linking to the library. It contains information about symbols that the library exposes.  
On Linux all the information needed is in the _.so file, but Windows split it for some reason, so you need an import library (_.dll.a, \*.lib) for linking, but the actual code resides in \*.dll. Only the \*.dll is required when running the application.

---

<div class="post-metadata">

### Author: ![xhc-code](https://discourse.cmake.org/user_avatar/discourse.cmake.org/xhc-code/32/3842_2.png) [@xhc-code](https://discourse.cmake.org/u/xhc-code)
#### Post date: [September 20, 2023, 7:09am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015/3 "2023-09-20T07:09:34Z")

</div>

Hello, when win is linked through cmake, there is no .dll.a import library. Will the link fail?

---

<div class="post-metadata">

### Author: ![fenrir](https://discourse.cmake.org/user_avatar/discourse.cmake.org/fenrir/32/734_2.png) [@fenrir](https://discourse.cmake.org/u/fenrir)
#### Post date: [September 20, 2023, 7:25am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015/4 "2023-09-20T07:25:38Z")

</div>

It doesn’t matter if you use CMake or something else - the linker uses the import library. So yes, either the .dll.a (in case of MinGW), or the .lib (MSVC, and probably clang) must exist. The linker does not care about the actual .dll.

---

<div class="post-metadata">

### Author: ![xhc-code](https://discourse.cmake.org/user_avatar/discourse.cmake.org/xhc-code/32/3842_2.png) [@xhc-code](https://discourse.cmake.org/u/xhc-code)
#### Post date: [September 20, 2023, 7:26am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015/5 "2023-09-20T07:26:38Z")

</div>

OK, thanks.

---

<div class="post-metadata">

### Author: ![xhc-code](https://discourse.cmake.org/user_avatar/discourse.cmake.org/xhc-code/32/3842_2.png) [@xhc-code](https://discourse.cmake.org/u/xhc-code)
#### Post date: [September 22, 2023, 5:00am UTC](https://discourse.cmake.org/t/questions-about-importing-library-file-xxx-dll-a-when-generating-dynamic-library-in-window-environment/9015/6 "2023-09-22T05:00:39Z")

</div>

[There is explanatory information about the DLL search path and import library](https://www.cnblogs.com/XingXiaoMeng/p/17721031.html%5D)
