1
votes

Trying to create an SQS queue with AWS C++ SDK.

Aws::SDKOptions options; 
Aws::InitAPI(options); 
Aws::Client::ClientConfiguration configuration; 
configuration.region = Aws::Region::US_WEST_2; 
Aws::SQS::SQSClient sqs = new Aws::SQS::SQSClient(Aws::Auth::AWSCredentials("abc", "def"), configuration);

Running on Windows, 64 bit, VC++.

When I run I will get an access violation:

Exception thrown at 0x000007FEE4E9C83C (aws-cpp-sdk-core.dll) in TestDB.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

This will happen deep in the call chain of the sdk. There are no parameters I can pass here as null pointers, so i'm not sure what it can be. I'm able to run against S3 with no issues, just SQS.

It looks like a missing initialization (but Aws::InitAPI(options); is called), or something with the memory management (which i use the default). Latest SDK version.

Any help or ideas will be appreciated.

-Yishai

Changed call to use Aws::SQS::SQSClient*, update all NuGet packages to the latets version (ends with x.60). This is the stack trace:

aws-cpp-sdk-core.dll!000007fee4dfd4bc() Unknown
aws-cpp-sdk-core.dll!000007fee4d07962() Unknown
aws-cpp-sdk-core.dll!000007fee4d30a11() Unknown
aws-cpp-sdk-core.dll!000007fee4d301a5() Unknown
aws-cpp-sdk-core.dll!000007fee4d02710() Unknown
aws-cpp-sdk-sqs.dll!000007fee4ffe4e1()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5046872()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5046968()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5046778()  Unknown
aws-cpp-sdk-sqs.dll!000007fee502f125()  Unknown
aws-cpp-sdk-sqs.dll!000007fee5002986()  Unknown
aws-cpp-sdk-sqs.dll!000007fee4fd2198()  Unknown

TestDB.exe!AmazonSQSQueue::AmazonSQSQueue(std::basic_string,std::allocator > queueIdentifier, Aws::Auth::AWSCredentials * cred) Line 263 C++

TestDB.exe!AmazonQueuesHolder::initilizeSQS(std::basic_string<char, std::char_traits<char>,std::allocator<char> > accessKey, std::basic_string<char,std::char_traits<char>,std::allocator<char> > secretKey, std::basic_string<char,std::char_traits<char>,std::allocator<char> > incommingQueueName, std::basic_string<char,std::char_traits<char>,std::allocator<char> > highPriorityQueueName, std::basic_string<char,std::char_traits<char>,std::allocator<char> > lowPriorityQueueName) Line 198   C++
TestDB.exe!SQSTest::SQSTest() Line 18   C++
TestDB.exe!testSQS() Line 24    C++
TestDB.exe!main(int argc, wchar_t * * argv) Line 183    C++
[External Code]
1

1 Answers

1
votes

After investigation, this is due to mismatched link types. Aws-cpp-sdk-core is linked in statically, while Aws-cpp-sdk-sqs was being linked dynamically. Changing the nuget packages to use the same link types, will fix the issue.