2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-28 07:22:31 +00:00

tutorial update

[SVN r17512]
This commit is contained in:
Joel de Guzman
2003-02-18 18:44:16 +00:00
parent 472dc3bd41
commit ff9f262fac
22 changed files with 561 additions and 221 deletions

View File

@@ -39,9 +39,9 @@ Following C/C++ tradition, let's start with the "hello, world". A C++
Function:</p>
<code><pre>
<span class=keyword>char </span><span class=keyword>const</span><span class=special>* </span><span class=identifier>greet</span><span class=special>()
</span><span class=special>{
{
</span><span class=keyword>return </span><span class=string>&quot;hello, world&quot;</span><span class=special>;
</span><span class=special>}
}
</span></pre></code>
<p>
can be exposed to Python by writing a Boost.Python wrapper:</p>
@@ -50,9 +50,9 @@ can be exposed to Python by writing a Boost.Python wrapper:</p>
</span><span class=keyword>using </span><span class=keyword>namespace </span><span class=identifier>boost</span><span class=special>::</span><span class=identifier>python</span><span class=special>;
</span><span class=identifier>BOOST_PYTHON_MODULE</span><span class=special>(</span><span class=identifier>hello</span><span class=special>)
</span><span class=special>{
{
</span><span class=identifier>def</span><span class=special>(</span><span class=string>&quot;greet&quot;</span><span class=special>, </span><span class=identifier>greet</span><span class=special>);
</span><span class=special>}
}
</span></pre></code>
<p>
That's it. We're done. We can now build this as a shared library. The
@@ -70,7 +70,7 @@ resulting DLL is now visible to Python. Here's a sample Python session:</p>
</tr>
</table>
<br>
<hr size="1"><p class="copyright">Copyright &copy; 2002 David Abrahams<br>Copyright &copy; 2002 Joel de Guzman<br><br>
<hr size="1"><p class="copyright">Copyright &copy; 2002-2003 David Abrahams<br>Copyright &copy; 2002-2003 Joel de Guzman<br><br>
<font size="2">Permission to copy, use, modify, sell and distribute this document
is granted provided this copyright notice appears in all copies. This document
is provided &quot;as is&quot; without express or implied warranty, and with