Skip to content

Commit 984769b

Browse files
committed
Add comments
1 parent ad289c5 commit 984769b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

swig/include/csharp/csharp_strings.i

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ static CSharpUtf8StringHelperCallback SWIG_csharp_string_callback = NULL;
3636

3737
public delegate System.IntPtr Utf8StringDelegate(System.IntPtr message);
3838

39+
/* IMPORTANT:
40+
* Every call to SWIG_csharp_string_callback MUST be followed by exactly one call
41+
* to LengthPrefixedUtf16UnmanagedToString on the returned pointer.
42+
* Failure to do so will result in memory leaks or double frees.
43+
*/
3944
static Utf8StringDelegate stringDelegate = new Utf8StringDelegate($modulePINVOKE.Utf8UnmanagedToLengthPrefixedUtf16Unmanaged);
4045

4146
[global::System.Runtime.InteropServices.DllImport("$dllimport", EntryPoint="RegisterUtf8StringCallback_$module")]

0 commit comments

Comments
 (0)