comments on alternative char* typemaps

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7027 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-03-06 15:42:11 +00:00
commit 6acd7d833d

View file

@ -650,7 +650,8 @@ using System.Runtime.InteropServices;
%include "enums.swg" %include "enums.swg"
/* /*
// Alternative char * typemaps // Alternative char * typemaps.
// Warning the GC may collect the SWIGStringMarshal instance while the unmanaged code is executing, so these typemaps should be avoided.
%pragma(csharp) imclasscode=%{ %pragma(csharp) imclasscode=%{
public class SWIGStringMarshal { public class SWIGStringMarshal {
public readonly IntPtr ptr; public readonly IntPtr ptr;
@ -664,7 +665,7 @@ using System.Runtime.InteropServices;
%} %}
%typemap(imtype) char *, char[ANY], char[] "IntPtr" %typemap(imtype) char *, char[ANY], char[] "IntPtr"
%typemap(out) char[ANY], char[] %{ $result = $1; %} %typemap(out) char *, char[ANY], char[] %{ $result = $1; %}
%typemap(csin) char *, char[ANY], char[] "new $modulePINVOKE.SWIGStringMarshal($csinput).ptr" %typemap(csin) char *, char[ANY], char[] "new $modulePINVOKE.SWIGStringMarshal($csinput).ptr"
%typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] { %typemap(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode string ret = System.Runtime.InteropServices.Marshal.PtrToStringAnsi($imcall);$excode
@ -672,7 +673,7 @@ using System.Runtime.InteropServices;
} }
%typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{ %typemap(csvarin, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
set { set {
new $modulePINVOKE.SwigStringMarshal($imcall).ptr;$excode $imcall;$excode
} %} } %}
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{ %typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
get { get {