Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in C# UTF-8 marshal method #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iinuwa
Copy link

@iinuwa iinuwa commented Sep 26, 2021

The "Passing Strings" example for C# states that marshalling UTF-8 strings must be done manually, but Marshal.PtrToStringUTF8() has been available since .NET 1.1. By not passing a length, it automatically detects null-terminated strings, so this can be shortened to one line.

(This diff compiles on Mono 6.12).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant