protoc-c: fix shared lib build on windows

Fixes #458

Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com>
This commit is contained in:
Ilya Lipnitskiy 2021-02-18 15:42:47 -08:00
parent 38af0d26ab
commit 2a278e0756
No known key found for this signature in database
GPG Key ID: 435C02AAE7CF2014

View File

@ -68,6 +68,12 @@
#include <string> #include <string>
#include <google/protobuf/compiler/code_generator.h> #include <google/protobuf/compiler/code_generator.h>
#if defined(_WIN32) && defined(PROTOBUF_C_USE_SHARED_LIB)
# define PROTOC_C_EXPORT __declspec(dllexport)
#else
# define PROTOC_C_EXPORT
#endif
namespace google { namespace google {
namespace protobuf { namespace protobuf {
namespace compiler { namespace compiler {
@ -77,7 +83,7 @@ namespace c {
// header. If you create your own protocol compiler binary and you want // 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 // it to support C++ output, you can do so by registering an instance of this
// CodeGenerator with the CommandLineInterface in your main() function. // CodeGenerator with the CommandLineInterface in your main() function.
class LIBPROTOC_EXPORT CGenerator : public CodeGenerator { class PROTOC_C_EXPORT CGenerator : public CodeGenerator {
public: public:
CGenerator(); CGenerator();
~CGenerator(); ~CGenerator();