support for asymmetric type marshalling - added out attribute for ctype, imtype and cstype typemaps
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7172 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
f7cad9956b
commit
9be34b6b9a
2 changed files with 50 additions and 6 deletions
|
|
@ -162,6 +162,40 @@ $jnicall -> $imcall
|
|||
</pre></div>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
The intermediary classname has <tt>PINVOKE</tt> appended after the module name instead of <tt>JNI</tt>, for example <tt>modulenamePINVOKE</tt>.
|
||||
</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>
|
||||
Support for asymmetric type marshalling. The 'ctype', 'imtype' and 'cstype' typemaps support an optional <tt>out</tt> attribute which is used for output types.
|
||||
If this typemap attribute is specified, then the type specified in the attribute is used for output types.
|
||||
the type specified in the typemap itself is used for the input type.
|
||||
If this typemap attribute is not specified, then the type used for both input and output is the type specified in the typemap.
|
||||
An example shows that <tt>char *</tt> could be marshalled in different ways,
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
%typemap(imtype, out="IntPtr") char * "string"
|
||||
char * function(char *);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The output type is thus IntPtr and the input type is string. The resulting intermediary C# code is:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
<pre>
|
||||
public static extern IntPtr function(string jarg1);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
@ -171,10 +205,6 @@ The special variable will get translated into the value specified by the <tt>-dl
|
|||
if specified, otherwise it is equivalent to the <b>$module</b> special variable.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The intermediary classname has <tt>PINVOKE</tt> appended after the module name instead of <tt>JNI</tt>, for example <tt>modulenamePINVOKE</tt>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The directory <tt>Examples/csharp</tt> has a number of simple examples.
|
||||
Visual Studio .NET 2003 solution and project files are available for compiling with the Microsoft .NET C# compiler on Windows.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue