Still not enough information. What is the size of the encoded Message string?
Even if it is configured to be encodedMessageSize, are you sure the qt generated string is ALWAYS smaller than the length of the passed in string?
If you call C functions you have to make sure that the passed in memory buffers that you try to have your DLL write data into is always AT least as large preallocated as the DLL function tries to write into. That's the only safe method if you have unmanaged data buffers. And if you use managed data buffers, the consumer (your DLL) needs to use the management contract of the caller. For a LabVIEW called DLL that is the LabVIEW memory managed data handles for arrays and strings!