'DLL interface parameter mangled for debug version but not for release version c++ visual studio

I have a library packaged as a DLL and I am strange behavior when I access a simple function from calling program (both in c++ and using visual studio 2019).
DLL header and function:

bool libvpop_EXPORT GetLibVersion(string& version);

bool GetLibVersion(string& version)
{
    version = VPOPLIB_VERSION;
    return true;
}

Calling code:

bool VPLIB_Return;

string verstring = "XX";
VPLIB_Return = GetLibVersion(verstring);

This works fine in the release version of the calling program but in the debug version, the verstring parameter appears to be completely mangled (i.e. verstring = "\x11ta\x2") between the call and the target function GetLibVersion. I have closely inspected the project properties between the debug and release versions, setting them equal and back to no avail. Just wondering if anyone has any insight as to why parameter passing would be different between a debug and release build. One other point, this DLL library has many other functions which appear to working just fine.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source