aws-sdk-cpp: Exception Thrown at aws-cpp-sdk-core.dll on x64 msvc build

After building the SDK for x64 bit architecture and implement a basic operational example, the program crashes with an Access violation writing location exception. The crash happens on the closing scope operator just before

Aws::ShutdownAPI(options);

command.

The corresponding error happens only on x64 builds both with Custom Build Sequence and Vcpkg using:

vcpkg install aws-sdk-cpp[core,s3,rds]:x64-windows

For x86 Builds (with the corresponding msvc compiler) the application runs successfully.

What platform/OS are you using?

Windows 10 x64

Which version of the SDK?

Version 2.0

What compiler are you using? what version?

Visual Studio 15 2017 Win64

What are your CMake arguments?

cmake <path> -G “Visual Studio 15 Win64” -DMINIMIZE_SIZE=ON -DBUILD_ONLY=“s3;rds;” -DCMAKE_BUILD_TYPE=Debug

Can you provide a TRACE level log? (sanitize any sensitive information)

The debugger stops at line 222 at xutility with the message:

Exception thrown at 0x00007FFD842D5C4D (aws-cpp-sdk-core.dll) in TestAWS_x64BUG.exe: 0xC0000005: Access violation writing location 0x00000000DDDDDDDD.

I’m also posting a minimal code snippet to reproduce:

#include "pch.h"
#include <iostream>

#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/Bucket.h>
#include <aws/s3/model/ListObjectsRequest.h>
#include <aws/s3/model/Object.h>
#include <aws/core/auth/AWSCredentials.h>
#include <aws/s3/model/HeadBucketRequest.h>
#include <aws/s3/model/PutObjectRequest.h>

static const char* KEY = "KEY";
static const char* ACCESS_KEY = "ACCESS_KEY";

int main()
{
	Aws::SDKOptions options;
	Aws::InitAPI(options);
	{
		Aws::Client::ClientConfiguration config;
		config.region = Aws::Region::US_EAST_2;
		Aws::S3::S3Client s3_client(Aws::Auth::AWSCredentials(KEY, ACCESS_KEY), config);
	} //CRASH POINT
	Aws::ShutdownAPI(options);

	return 0;
}

*Note that I have already define:

USE_IMPORT_EXPORT;

USE_WINDOWS_DLL_SEMANTICS;

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (2 by maintainers)

Most upvoted comments

@KaibaLopez , The issue solved after replacing the include folder with the Vpckg one. It seems that a code error caused the problem and not a linking mismatch.
Thanks!

Hi @ThanasisPap , I’m trying to reproduce this error but having some problems. In my experience dll access violation errors such as these are commonly due to trying to use a dll file created for a different build, like referencing a dll generated for debug for a release build or win32 for a x64, etc. Could you check that the dlls in the output folder(TestAWS_x64BUG/x64/Debug) are the correct ones?