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">
|
||||
<pre>
|
||||
%typemap(directorin,descriptor="Ljava/lang/String;") char *
|
||||
%{ $input = jenv->NewStringUTF($1); %}
|
||||
%typemap(directorin, descriptor="Ljava/lang/String;", noblock=1) char * %{
|
||||
$input = 0;
|
||||
if ($1) {
|
||||
$input = JCALL1(NewStringUTF, jenv, (const char *)$1);
|
||||
if (!$input) return $null;
|
||||
}
|
||||
Swig::LocalRefGuard $1_refguard(jenv, $input);
|
||||
%}
|
||||
</pre>
|
||||
</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>
|
||||
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