File tree Expand file tree Collapse file tree 3 files changed +29
-5
lines changed
Expand file tree Collapse file tree 3 files changed +29
-5
lines changed Original file line number Diff line number Diff line change 3232# define ICEBERG_EXPORT __attribute__((visibility("default")))
3333# endif
3434#endif
35+
36+ // Template export attributes require compiler-specific handling.
37+ // See: http://www.codesynthesis.com/~boris/blog/2010/01/18/dll-export-cxx-templates/
38+ #if defined(_WIN32 ) || defined(__CYGWIN__ )
39+ # define ICEBERG_TEMPLATE_EXPORT ICEBERG_EXPORT
40+ #else
41+ # define ICEBERG_TEMPLATE_EXPORT
42+ #endif
43+
44+ // Visibility for template class declarations.
45+ // Keep empty on MSVC to avoid `extern` + `dllexport` C4910 interactions.
46+ #if defined(_MSC_VER )
47+ # define ICEBERG_TEMPLATE_TYPE_EXPORT
48+ #else
49+ # define ICEBERG_TEMPLATE_TYPE_EXPORT ICEBERG_EXPORT
50+ #endif
51+
52+ // MSVC doesn't allow explicit instantiation declarations as `extern` +
53+ // `__declspec(dllexport)` (C4910).
54+ #if defined(_MSC_VER ) && defined(ICEBERG_EXPORTING ) && !defined(ICEBERG_STATIC )
55+ # define ICEBERG_EXTERN_TEMPLATE_EXPORT
56+ #else
57+ # define ICEBERG_EXTERN_TEMPLATE_EXPORT ICEBERG_TEMPLATE_EXPORT
58+ #endif
Original file line number Diff line number Diff line change @@ -617,7 +617,7 @@ bool StructLikeSet<kValidate>::KeyEqual::operator()(
617617 return StructLikeEqualUnchecked (*lhs, rhs);
618618}
619619
620- template class StructLikeSet <true >;
621- template class StructLikeSet <false >;
620+ template class ICEBERG_TEMPLATE_EXPORT StructLikeSet<true >;
621+ template class ICEBERG_TEMPLATE_EXPORT StructLikeSet<false >;
622622
623623} // namespace iceberg
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ namespace iceberg {
4545// / only when the caller guarantees schema conformance and the validation
4646// / overhead must be avoided.
4747template <bool kValidate = true >
48- class ICEBERG_EXPORT StructLikeSet {
48+ class ICEBERG_TEMPLATE_TYPE_EXPORT StructLikeSet {
4949 public:
5050 // / \brief Create a StructLikeSet for the given struct type.
5151 explicit StructLikeSet (const StructType& type);
@@ -102,7 +102,7 @@ class ICEBERG_EXPORT StructLikeSet {
102102// / that guarantee schema conformance.
103103using UncheckedStructLikeSet = StructLikeSet<false >;
104104
105- extern template class StructLikeSet <true >;
106- extern template class StructLikeSet <false >;
105+ extern template class ICEBERG_EXTERN_TEMPLATE_EXPORT StructLikeSet<true >;
106+ extern template class ICEBERG_EXTERN_TEMPLATE_EXPORT StructLikeSet<false >;
107107
108108} // namespace iceberg
You can’t perform that action at this time.
0 commit comments