diff --git a/paddle/fluid/pybind/protobuf.cc b/paddle/fluid/pybind/protobuf.cc index 0443ff3fc3d055c54527240cdf57c195e1c0acf8..8735b658758dfefeedcb1393b82682ad968739de 100644 --- a/paddle/fluid/pybind/protobuf.cc +++ b/paddle/fluid/pybind/protobuf.cc @@ -29,8 +29,16 @@ limitations under the License. */ namespace pybind11 { namespace detail { +#if !defined(PYBIND11_HIDDEN) +#ifdef _WIN32 +#define PYBIND11_HIDDEN __declspec(dllexport) +#else +#define PYBIND11_HIDDEN __attribute__((visibility("hidden"))) +#endif +#endif + // Can be replaced by a generic lambda in C++14 -struct __attribute__((visibility("hidden"))) paddle_variant_caster_visitor +struct PYBIND11_HIDDEN paddle_variant_caster_visitor : public boost::static_visitor { return_value_policy policy; handle parent;