On Mac OS X, I've been having bugs when marshalling Mono string back and
between managed and unmanaged code with SWIG, like input string "abc"
becomes "ac" when coming into my unmanaged side. My managed code
public static extern string
the corresponding unmanaged C++ function:
DLLEXPORT std::string SetPath(const wchar_t* path)
std::copy(ws.begin(), ws.end(), s.begin());
Then the returned strings are totally wrong, which seem to not only have
missing characters but also have been shuffled.
The similar code works fine for char* version.
And the same code works on Windows.
I came across this old post from 2008 saying it's SWIG's bug.
I wonder if what it says still holds and does anyone have an idea about how
to fix my problem?
Do I have to customize string modules like std_wstring.i??