Export .dll symbols from dependant library (.lib)

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 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. 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.


I don’t think there’s a mechanism for that today. This issue may be of interest.