diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2020-08-13 16:04:10 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2020-08-13 16:06:48 +0100 |
commit | bfddc50a6a38193acabaf8d895c5e472718a9a4d (patch) | |
tree | fb3417b58d68143ff5a817b29b9aba5db57ff7b0 | |
parent | a38f30a19475603f0b97ad4d1db9a1e1e2c02b54 (diff) | |
download | swig-bfddc50a6a38193acabaf8d895c5e472718a9a4d.tar.gz |
Add C# support for void *VOID_INT_PTR member variables
Issue reported by Carlos Frederico Biscaya on swig-user mailing list.
-rw-r--r-- | Examples/test-suite/csharp/director_void_runme.cs | 6 | ||||
-rw-r--r-- | Examples/test-suite/director_void.i | 4 | ||||
-rw-r--r-- | Lib/csharp/csharp.swg | 9 |
3 files changed, 19 insertions, 0 deletions
diff --git a/Examples/test-suite/csharp/director_void_runme.cs b/Examples/test-suite/csharp/director_void_runme.cs index 24b470f11..ef440a76a 100644 --- a/Examples/test-suite/csharp/director_void_runme.cs +++ b/Examples/test-suite/csharp/director_void_runme.cs @@ -67,6 +67,12 @@ public class runme if (x != 1334) throw new Exception("Bad4 should be 1334, got " + x); } + { + MemberVoid mv = new MemberVoid(); + global::System.IntPtr zero = global::System.IntPtr.Zero; + mv.memberVariable = zero; + zero = mv.memberVariable; + } } } diff --git a/Examples/test-suite/director_void.i b/Examples/test-suite/director_void.i index 40f53b6e2..d9d99aaac 100644 --- a/Examples/test-suite/director_void.i +++ b/Examples/test-suite/director_void.i @@ -43,5 +43,9 @@ struct Caller { return *(int *)p; } }; + +struct MemberVoid { + void *memberVariable; +}; %} diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg index 832206386..ecc1983a7 100644 --- a/Lib/csharp/csharp.swg +++ b/Lib/csharp/csharp.swg @@ -875,6 +875,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) { global::System.IntPtr ret = $imcall;$excode return ret; } +%typemap(csvarin, excode=SWIGEXCODE2) void *VOID_INT_PTR %{ + set { + $imcall;$excode + } %} +%typemap(csvarout, excode=SWIGEXCODE2) void *VOID_INT_PTR %{ + get { + global::System.IntPtr ret = $imcall;$excode + return ret; + } %} %typemap(csdirectorin) void *VOID_INT_PTR "$iminput" %typemap(csdirectorout) void *VOID_INT_PTR "$cscall" |