File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change 1111
1212#include " src/torchcodec/_core/AVIOContextHolder.h"
1313
14- // pybind11 has specific visibility rules; see:
15- // https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
16- // This file is included in both pybind_ops.cpp and custom_ops.cpp. We compile
17- // pybind_ops.cpp with the global visibility flag as required. On the
18- // custom_ops.cpp side we don't need to do that. However, we do need to ensure
19- // that this class is also seen as the same visibility.
20- //
21- // This only matters on Linux and Mac; on Windows we don't need to do anything.
22- #ifdef _WIN32
23- #define VISIBILITY_HIDDEN
24- #else
25- #define VISIBILITY_HIDDEN __attribute__ ((visibility(" hidden" )))
26- #endif
27-
2814namespace py = pybind11;
2915
3016namespace facebook ::torchcodec {
3117
3218// Enables uers to pass in a Python file-like object. We then forward all read
3319// and seek calls back up to the methods on the Python object.
34- class VISIBILITY_HIDDEN AVIOFileLikeContext : public AVIOContextHolder {
20+ class AVIOFileLikeContext : public AVIOContextHolder {
3521 public:
3622 explicit AVIOFileLikeContext (const py::object& fileLike, bool isForWriting);
3723
Original file line number Diff line number Diff line change @@ -175,12 +175,19 @@ function(make_torchcodec_libraries
175175 # stray initialization of py::objects. The rest of the object code must
176176 # match. See:
177177 # https://pybind11.readthedocs.io/en/stable/faq.html#someclass-declared-with-greater-visibility-than-the-type-of-its-field-someclass-member-wattributes
178+ # We have to do this for both pybind_ops and custom_ops because they include
179+ # some of the same headers.
178180 if (NOT WIN32 )
179181 target_compile_options (
180182 ${pybind_ops_library_name}
181183 PUBLIC
182184 "-fvisibility=hidden"
183185 )
186+ target_compile_options (
187+ ${custom_ops_library_name}
188+ PUBLIC
189+ "-fvisibility=hidden"
190+ )
184191 endif ()
185192
186193 # The value we use here must match the value we return from
You can’t perform that action at this time.
0 commit comments