Document native string marshalling for plugin wrappers
- Status
- Fixed
- Fixed in
- v26.10.2
- Area
- docs
- Source discussion
- -
- Last updated
- 2026-10-12
Upvotes
0 upvotes
Uses your Objo forum account.
Public summary
The plugin SDK guide shows P/Invoke wrappers around native libraries but never explains string marshalling across the native boundary. Classic [DllImport] marshals string parameters as UTF-8 on macOS and Linux but as the Windows system code page on Windows, so wrappers with string-taking native calls silently behave differently per platform. The guide should document the three supported patterns — CharSet = CharSet.Unicode for wchar_t* ABIs, [MarshalAs(UnmanagedType.LPUTF8Str)] for UTF-8 everywhere, and [LibraryImport(StringMarshalling = StringMarshalling.Utf8)] (which needs AllowUnsafeBlocks in the wrapper's own project file) — and clarify that Objo String to wrapper string needs no configuration.