C++ codegen with __declspec(dllexport) #2026
Replies: 3 comments
-
This is not supported, no. Even the Cap'n Proto runtime library itself lacks export declarations. Somewhat surprisingly, I don't think anyone has ever brought up the issue until now, suggesting that demand for dynamically linking capnproto on Windows is pretty low. I'd accept a PR to support it, but it's a lot of work and I don't expect to have the bandwidth to work on it myself. If you want to make a PR, please target the |
Beta Was this translation helpful? Give feedback.
-
I had a need to add Windows export declarations for capnproto-c (not C++) a while back. If needed, you may want to start with the CMake bits at https://gitlab.com/dkml/ext/c-capnproto/-/blob/1089ab8441b10765579d17ca519278a5c31dea0c/CMakeLists.txt#L55-136 and then work your way into the code. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestions! However, in the end, we went with the cheapest solution and hacked our build system to do a regex replace of |
Beta Was this translation helpful? Give feedback.
-
Currently, generated C++ source code from capnp schema files use
CAPNP_DECLARE_SCHEMA
macro, which expands toextern <schema global vars>
. As a result, I am unable to have users of my shared library link to these schema variables since they are not exported.Is there a way for me to control the codegen to generate
__declspec(dllexport)
in place ofextern
? Better yet, would it be possible for it to generateMY_API
macro in place ofexern
so thatMY_API
can generate platform specific export attributes?Beta Was this translation helpful? Give feedback.
All reactions