BewareMyPower opened a new pull request, #108:
URL: https://github.com/apache/pulsar-client-cpp/pull/108

   Fixes https://github.com/apache/pulsar-client-cpp/issues/107
   
   ### Motivation
   
   The `MessageId::getDataAsString()` API returns a `std::string` to the 
application side. In most cases it's not an issue. However, when building 
Windows DLLs with `LINK_STATIC=ON`, the library will be built with `/MTd` or 
`/MT` option to link 3rd party dependencies statically. In this case, the DLL 
and the application have different C runtime libraries that allocate or 
deallocate memory. The returned `std::string` object is allocated inside the 
DLL, while it will be destroyed in the application. The destruction could crash 
because the application C runtime cannot find the heap address from the C 
runtime in DLL.
   
   ### Modifications
   
   For MSVC debug build, change the API to return a const reference to 
`std::string`. Then the original `std::string` object will be deallocated 
inside the DLL.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to