Select to view content in your preferred language

Do you really need to use a std:wstring for your strings?

994
2
01-25-2011 04:06 AM
DonnyVelazquez
Frequent Contributor
I'v been trying to create a wrapper for the API in .Net and I ran across a memory management error with the wstrings. It seems that .Net can't marshal them.

Can you change the API to use something more friendly to .Net or provide some type of C++/CLR bridge?

Here is the same question on stackoverflow with code.
http://stackoverflow.com/questions/4763953/getting-error-attempted-to-read-or-write-protected-memory
0 Kudos
2 Replies
LanceShipman
Esri Regular Contributor
For portability reasons we need to use wstrings. You may want to look at the following on marshaling wstrings:

http://www.nuclex.org/articles/5-cxx/10-marshaling-strings-in-cxx-cli
0 Kudos
DonnyVelazquez
Frequent Contributor
I'm not a C++ programmer I work with .Net, so how exactly would I implement this?
0 Kudos