Document -const option.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11391 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3fb96c2364
commit
9042e4d2f9
1 changed files with 14 additions and 1 deletions
|
|
@ -815,7 +815,7 @@ extern char *path; // Declared later in the input
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Constants are wrapped as read-only Perl variables. For example:
|
By default, constants are wrapped as read-only Perl variables. For example:
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="code">
|
<div class="code">
|
||||||
|
|
@ -838,6 +838,19 @@ $example::FOO = 2; # Error
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Alternatively, if you use swig's <tt>-const</tt> option, constants are wrapped
|
||||||
|
such that the leading $ isn't required (by using a constant subroutine), which
|
||||||
|
usually gives a more natural Perl interface, for example:
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="targetlang">
|
||||||
|
<pre>
|
||||||
|
use example;
|
||||||
|
print example::FOO,"\n";
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
|
||||||
<H3><a name="Perl5_nn18"></a>28.4.4 Pointers</H3>
|
<H3><a name="Perl5_nn18"></a>28.4.4 Pointers</H3>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue