Skip to content
Discussion options

You must be logged in to vote

rules for passing value types between C++ and C#.
I'm running into an issue with passing strings between C++ and C#

Let me address the string angle and then talk about the value type and language rules.

Strings always seem to be a special case and I find they tend to get overengineered at the margins. In this case I'm unsure of the utility for passing a value type across the interop boundary for a string. My suggestion here would be to default to the C definiton of a string, a sequence of non-zero bytes with a zero-value terminator, and rely upon that as you marshal across the interop boundary. That string definition should be updated appropriately based on encoding, which brings me to.…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@peter1745
Comment options

Answer selected by peter1745
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants