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:
parent
b2ec22090d
commit
6acd7d833d
1 changed files with 4 additions and 3 deletions
|
|
@ -650,7 +650,8 @@ using System.Runtime.InteropServices;
|
|||
%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=%{
|
||||
public class SWIGStringMarshal {
|
||||
public readonly IntPtr ptr;
|
||||
|
|
@ -664,7 +665,7 @@ using System.Runtime.InteropServices;
|
|||
%}
|
||||
|
||||
%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(csout, excode=SWIGEXCODE) char *, char[ANY], char[] {
|
||||
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[] %{
|
||||
set {
|
||||
new $modulePINVOKE.SwigStringMarshal($imcall).ptr;$excode
|
||||
$imcall;$excode
|
||||
} %}
|
||||
%typemap(csvarout, excode=SWIGEXCODE2) char *, char[ANY], char[] %{
|
||||
get {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue