File tree Expand file tree Collapse file tree 3 files changed +29
-6
lines changed
Expand file tree Collapse file tree 3 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 2727# else
2828# define ICEBERG_EXPORT __declspec(dllimport)
2929# endif
30- #else // Not Windows
30+
31+ # define ICEBERG_TEMPLATE_EXPORT ICEBERG_EXPORT
32+
33+ // Visibility for template class declarations.
34+ // Keep empty on MSVC to avoid `extern` + `dllexport` C4910 interactions.
35+ # if defined(_MSC_VER )
36+ # define ICEBERG_TEMPLATE_TYPE_EXPORT
37+ # else
38+ # define ICEBERG_TEMPLATE_TYPE_EXPORT ICEBERG_EXPORT
39+ # endif
40+
41+ // MSVC doesn't allow explicit instantiation declarations as `extern` +
42+ // `__declspec(dllexport)` (C4910).
43+ # if defined(_MSC_VER ) && defined(ICEBERG_EXPORTING ) && !defined(ICEBERG_STATIC )
44+ # define ICEBERG_EXTERN_TEMPLATE_EXPORT
45+ # else
46+ # define ICEBERG_EXTERN_TEMPLATE_EXPORT ICEBERG_TEMPLATE_EXPORT
47+ # endif
48+
49+ #else // Non-Windows
3150# ifndef ICEBERG_EXPORT
3251# define ICEBERG_EXPORT __attribute__((visibility("default")))
3352# endif
53+
54+ # define ICEBERG_TEMPLATE_EXPORT
55+ # define ICEBERG_TEMPLATE_TYPE_EXPORT ICEBERG_EXPORT
56+ # define ICEBERG_EXTERN_TEMPLATE_EXPORT ICEBERG_TEMPLATE_EXPORT
3457#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