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 11
11
12
12
#include " src/torchcodec/_core/AVIOContextHolder.h"
13
13
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
-
28
14
namespace py = pybind11;
29
15
30
16
namespace facebook ::torchcodec {
31
17
32
18
// Enables uers to pass in a Python file-like object. We then forward all read
33
19
// and seek calls back up to the methods on the Python object.
34
- class VISIBILITY_HIDDEN AVIOFileLikeContext : public AVIOContextHolder {
20
+ class AVIOFileLikeContext : public AVIOContextHolder {
35
21
public:
36
22
explicit AVIOFileLikeContext (const py::object& fileLike, bool isForWriting);
37
23
Original file line number Diff line number Diff line change @@ -175,12 +175,19 @@ function(make_torchcodec_libraries
175
175
# stray initialization of py::objects. The rest of the object code must
176
176
# match. See:
177
177
# 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.
178
180
if (NOT WIN32 )
179
181
target_compile_options (
180
182
${pybind_ops_library_name}
181
183
PUBLIC
182
184
"-fvisibility=hidden"
183
185
)
186
+ target_compile_options (
187
+ ${custom_ops_library_name}
188
+ PUBLIC
189
+ "-fvisibility=hidden"
190
+ )
184
191
endif ()
185
192
186
193
# The value we use here must match the value we return from
You can’t perform that action at this time.
0 commit comments