Java doc update for directorin typemaps and Swig::LocalRefGuard
Motivated by fixes in patch #704 [skip ci]
This commit is contained in:
parent
bdda0a0829
commit
108d82a886
1 changed files with 15 additions and 2 deletions
|
|
@ -6350,11 +6350,24 @@ A typemap for C character strings is:
|
||||||
|
|
||||||
<div class="code">
|
<div class="code">
|
||||||
<pre>
|
<pre>
|
||||||
%typemap(directorin,descriptor="Ljava/lang/String;") char *
|
%typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) char * %{
|
||||||
%{ $input = jenv->NewStringUTF($1); %}
|
$input = 0;
|
||||||
|
if ($1) {
|
||||||
|
$input = JCALL1(NewStringUTF, jenv, (const char *)$1);
|
||||||
|
if (!$input) return $null;
|
||||||
|
}
|
||||||
|
Swig::LocalRefGuard $1_refguard(jenv, $input);
|
||||||
|
%}
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The <tt>Swig::LocalRefGuard</tt> class should be used in directorin typemaps for newly allocated objects.
|
||||||
|
It is used to control local reference counts ensuring the count is decremented after the call up into Java has completed.
|
||||||
|
Its destructor simply calls <tt>jenv->DeleteLocalRef(obj)</tt> on the <tt>obj</tt>
|
||||||
|
passed in during construction.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
User-defined types have the default "descriptor" attribute "<code>L$packagepath/$javaclassname;</code>" where <code>$packagepath</code>
|
User-defined types have the default "descriptor" attribute "<code>L$packagepath/$javaclassname;</code>" where <code>$packagepath</code>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue