# Export .dll symbols from dependant library (.lib)

**URL:** https://discourse.cmake.org/t/export-dll-symbols-from-dependant-library-lib/9901
**Category:** Code
**Tags:** os:windows
**Created:** [January 22, 2024, 3:00pm UTC](https://discourse.cmake.org/t/export-dll-symbols-from-dependant-library-lib/9901 "2024-01-22T15:00:24Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![rhubner](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/e47c2d/32.png) [@rhubner](https://discourse.cmake.org/u/rhubner)
#### Post date: [January 22, 2024, 3:00pm UTC](https://discourse.cmake.org/t/export-dll-symbols-from-dependant-library-lib/9901/1 "2024-01-22T15:00:24Z")

</div>

Hello CMake community,

I need help with one requirement on our project which recently popped up. We are releasing RocksDBJava for multiple platforms including MS WIndows.

Recently C# community [contacted us](https://github.com/facebook/rocksdb/issues/12226) that they would like to use our .dll and if we can also export symbols from RocksDB(dependent library for our project) and not only RocksDBJava. So far I was able to resolve this problem only by [manually creating a DEF file](https://github.com/facebook/rocksdb/pull/12246). Unfortunately, creating this file manually is very error prone.

It will be great if we can update our CMake script to automatically generate DEF file(For example from header files), or tweak our build system to export all functions from a dependent library(RocksDB). So far I also tried to use ENABLE\_EXPORTS and WINDOWS\_EXPORT\_ALL\_SYMBOLS, but it didn’t work at all.

I think our problem originates from the “two steps” build process. First we build RocksDB as .lib (and also as a shared .dll) and then we link this with RocksDBJava to create a .dll for JVM.

Radek.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [January 22, 2024, 3:04pm UTC](https://discourse.cmake.org/t/export-dll-symbols-from-dependant-library-lib/9901/2 "2024-01-22T15:04:23Z")

</div>

I don’t think there’s a mechanism for that today. [This issue](https://gitlab.kitware.com/cmake/cmake/-/issues/22679) may be of interest.
