From 2a278e0756ee4c1a4590e90d363ff37ba10b9f44 Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Thu, 18 Feb 2021 15:42:47 -0800 Subject: [PATCH] protoc-c: fix shared lib build on windows Fixes #458 Signed-off-by: Ilya Lipnitskiy --- protoc-c/c_generator.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/protoc-c/c_generator.h b/protoc-c/c_generator.h index 9d94bec..ac1ffaf 100644 --- a/protoc-c/c_generator.h +++ b/protoc-c/c_generator.h @@ -68,6 +68,12 @@ #include #include +#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB) +# define PROTOC_C_EXPORT __declspec(dllexport) +#else +# define PROTOC_C_EXPORT +#endif + namespace google { namespace protobuf { namespace compiler { @@ -77,7 +83,7 @@ namespace c { // header. If you create your own protocol compiler binary and you want // it to support C++ output, you can do so by registering an instance of this // CodeGenerator with the CommandLineInterface in your main() function. -class LIBPROTOC_EXPORT CGenerator : public CodeGenerator { +class PROTOC_C_EXPORT CGenerator : public CodeGenerator { public: CGenerator(); ~CGenerator();