Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix template class instantiation #2558

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/aws-cpp-sdk-core/include/aws/core/Core_EXPORTS.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
#else // AWS_CORE_EXPORTS
#define AWS_CORE_API __declspec(dllimport)
#endif // AWS_CORE_EXPORTS
#define AWS_CORE_EXTERN
#else // USE_IMPORT_EXPORT
#define AWS_CORE_API
#define AWS_CORE_EXTERN extern
#endif // USE_IMPORT_EXPORT
#define AWS_CORE_LOCAL
#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32)
#define AWS_CORE_API
#define AWS_CORE_EXTERN extern
#if __GNUC__ >= 4
#define AWS_CORE_LOCAL __attribute__((visibility("hidden")))
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,13 @@ namespace Aws
BuiltInParametersT m_builtInParameters;
};

// Export symbol from the DLL:
template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration</*HasEndpointDiscovery*/ true> >;
/**
* Export endpoint provider symbols for Windows DLL, otherwise declare as extern
*/
AWS_CORE_EXTERN template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration<false>,
Aws::Endpoint::BuiltInParameters,
Aws::Endpoint::ClientContextParameters>;

AWS_CORE_EXTERN template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration<true>>;
} // namespace Endpoint
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ namespace Aws
virtual ResolveEndpointOutcome ResolveEndpoint(const EndpointParameters& endpointParameters) const = 0;
};

// Export symbol from the DLL:
template class AWS_CORE_API EndpointProviderBase<Aws::Client::GenericClientConfiguration</*HasEndpointDiscovery*/ true> >;
/**
* Export endpoint provider symbols for Windows DLL, otherwise declare as extern
*/
AWS_CORE_EXTERN template class AWS_CORE_API EndpointProviderBase<Aws::Client::GenericClientConfiguration<true>>;
} // namespace Endpoint
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ namespace Aws
namespace Endpoint
{

#ifndef AWS_CORE_EXPORTS // Except for Windows DLL
/**
* Export endpoint provider symbols from DLL
* Instantiate endpoint providers
*/
template class AWS_CORE_API DefaultEndpointProvider<Aws::Client::GenericClientConfiguration<false>,
template class DefaultEndpointProvider<Aws::Client::GenericClientConfiguration<false>,
Aws::Endpoint::BuiltInParameters,
Aws::Endpoint::ClientContextParameters>;

template class DefaultEndpointProvider<Aws::Client::GenericClientConfiguration<true>>;
#endif

char CharToDec(const char c)
{
if(c >= '0' && c <= '9')
Expand Down
7 changes: 5 additions & 2 deletions src/aws-cpp-sdk-core/source/endpoint/EndpointProviderBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ namespace Aws
{
namespace Endpoint
{
#ifndef AWS_CORE_EXPORTS // Except for Windows DLL
/**
* Export endpoint provider symbols from DLL
* Instantiate endpoint providers
*/
template class AWS_CORE_API EndpointProviderBase<Aws::Client::GenericClientConfiguration<false>,
template class EndpointProviderBase<Aws::Client::GenericClientConfiguration<false>,
Aws::Endpoint::BuiltInParameters,
Aws::Endpoint::ClientContextParameters>;

template class EndpointProviderBase<Aws::Client::GenericClientConfiguration<true>>;
#endif
} // namespace Endpoint
} // namespace Aws
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
\#else
$define ${api} __declspec(dllimport)
#endif /* AWS_${metadata.classNamePrefix.toUpperCase()}_EXPORTS */
$define AWS_${metadata.classNamePrefix.toUpperCase()}_EXTERN
\#else
$define ${api}
$define AWS_${metadata.classNamePrefix.toUpperCase()}_EXTERN extern
#endif // USE_IMPORT_EXPORT
\#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
$define ${api}
$define AWS_${metadata.classNamePrefix.toUpperCase()}_EXTERN extern
#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (WIN32)
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#set($epContextClassName = "${metadata.classNamePrefix}ClientContextParameters")
#set($epBuiltInClassName = "${metadata.classNamePrefix}BuiltInParameters")
#set($exportMacro = "${CppViewHelper.computeExportValue($metadata.classNamePrefix)}")
#set($externMacro = "AWS_${metadata.classNamePrefix.toUpperCase()}_EXTERN")
#pragma once
\#include <aws/${metadata.projectName}/${metadata.classNamePrefix}_EXPORTS.h>
#if($serviceModel.metadata.serviceId == "S3" || $serviceModel.metadata.serviceId == "S3 Control")
Expand Down Expand Up @@ -101,12 +102,12 @@ using ${metadata.classNamePrefix}DefaultEpProviderBase =
namespace Endpoint
{
/**
* Export endpoint provider symbols from DLL
* Export endpoint provider symbols for Windows DLL, otherwise declare as extern
*/
template class ${exportMacro}
${externMacro} template class ${exportMacro}
Aws::Endpoint::EndpointProviderBase<${serviceNamespace}::Endpoint::${metadata.classNamePrefix}ClientConfiguration, ${serviceNamespace}::Endpoint::${epBuiltInClassName}, ${serviceNamespace}::Endpoint::${epContextClassName}>;

template class ${exportMacro}
${externMacro} template class ${exportMacro}
Aws::Endpoint::DefaultEndpointProvider<${serviceNamespace}::Endpoint::${metadata.classNamePrefix}ClientConfiguration, ${serviceNamespace}::Endpoint::${epBuiltInClassName}, ${serviceNamespace}::Endpoint::${epContextClassName}>;
} // namespace Endpoint

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@

namespace ${rootNamespace}
{
#if($serviceModel.metadata.serviceId == "S3" || $serviceModel.metadata.serviceId == "S3 Control" || $serviceModel.clientContextParams)
#ifndef AWS_${metadata.classNamePrefix.toUpperCase()}_EXPORTS // Except for Windows DLL
namespace Endpoint
{
/**
* Instantiate endpoint providers
*/
template class Aws::Endpoint::EndpointProviderBase<${serviceNamespace}::Endpoint::${metadata.classNamePrefix}ClientConfiguration,
${serviceNamespace}::Endpoint::${epBuiltInClassName},
${serviceNamespace}::Endpoint::${epContextClassName}>;

template class Aws::Endpoint::DefaultEndpointProvider<${serviceNamespace}::Endpoint::${metadata.classNamePrefix}ClientConfiguration,
${serviceNamespace}::Endpoint::${epBuiltInClassName},
${serviceNamespace}::Endpoint::${epContextClassName}>;
} // namespace Endpoint
#endif

#end
namespace ${serviceNamespace}
{
namespace Endpoint
Expand Down