diff --git a/include/aws/crt/Exports.h b/include/aws/crt/Exports.h index bd171dc73..1d9d3369a 100644 --- a/include/aws/crt/Exports.h +++ b/include/aws/crt/Exports.h @@ -28,6 +28,8 @@ # else # define AWS_CRT_CPP_API # endif // AWS_CRT_CPP_USE_IMPORT_EXPORT +# define AWS_CRT_CPP_TEMPLATE_DECLARATION extern template class +# define AWS_CRT_CPP_TEMPLATE_DEFINITION template class AWS_CRT_CPP_API #else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32) # if ((__GNUC__ >= 4) || defined(__clang__)) && defined(AWS_CRT_CPP_USE_IMPORT_EXPORT) && \ @@ -36,4 +38,6 @@ # else # define AWS_CRT_CPP_API # endif // __GNUC__ >= 4 || defined(__clang__) +# define AWS_CRT_CPP_TEMPLATE_DECLARATION extern template class AWS_CRT_CPP_API +# define AWS_CRT_CPP_TEMPLATE_DEFINITION template class AWS_CRT_CPP_API #endif diff --git a/include/aws/crt/Types.h b/include/aws/crt/Types.h index 45d086258..2e543e325 100644 --- a/include/aws/crt/Types.h +++ b/include/aws/crt/Types.h @@ -23,7 +23,7 @@ struct aws_byte_buf; struct aws_byte_cursor; struct aws_socket_options; -extern template class std::basic_string, Aws::Crt::StlAllocator>; +AWS_CRT_CPP_TEMPLATE_DECLARATION std::basic_string, Aws::Crt::StlAllocator>; namespace Aws { diff --git a/source/Types.cpp b/source/Types.cpp index 042479c25..a861807d5 100644 --- a/source/Types.cpp +++ b/source/Types.cpp @@ -6,7 +6,7 @@ #include -template class AWS_CRT_CPP_API std::basic_string, Aws::Crt::StlAllocator>; +AWS_CRT_CPP_TEMPLATE_DEFINITION std::basic_string, Aws::Crt::StlAllocator>; namespace Aws {