# CMake doesn't link the actual object to the resulting dll

**URL:** https://discourse.cmake.org/t/cmake-doesnt-link-the-actual-object-to-the-resulting-dll/1866
**Category:** Usage
**Created:** [September 20, 2020, 5:19am UTC](https://discourse.cmake.org/t/cmake-doesnt-link-the-actual-object-to-the-resulting-dll/1866 "2020-09-20T05:19:47Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [September 20, 2020, 6:37am UTC](https://discourse.cmake.org/t/cmake-doesnt-link-the-actual-object-to-the-resulting-dll/1866/2 "2020-09-20T06:37:09Z")

</div>

Rather than manually implementing all that logic for working out whether you need to export the class symbols or not, I recommend you consider using the `GenerateExportHeader` module instead. It makes handling these things very straightforward and has the added benefit of broad platform/compiler support too. You can get a good introduction to this from the first part of my CppCon talk from last year:

> **[CppCon 2019: Deep CMake For Library Authors - Crascit](https://crascit.com/2019/10/16/cppcon-2019-deep-cmake-for-library-authors/)**
>
> This talk highlights key CMake features relevant to C++ cross-platform library authors, digging deeper into platform-specific quirks and conventions.

In your case, I think you’ll find that `BLINKER_API` is not being defined to what you expect when building your library. The logic for the preprocessor paths that would define it all rely on either `_BLINKER_BUILD_DLL` or `BLINKER_DLL` being defined, but I don’t see either of those being defined in your CMake source. Again, the `GenerateExportHeader` module takes care of that aspect for you too, so take a look at that and it should simplify this for you considerably.

---

_[View the full topic](https://discourse.cmake.org/t/cmake-doesnt-link-the-actual-object-to-the-resulting-dll/1866)._
