Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
3a323e22
Commit
3a323e22
authored
Sep 22, 2018
by
Robert Bradshaw
Committed by
GitHub
Sep 22, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2623 from nicktimko/patch-1
Call out the different name used for the wrapper
parents
c24b62b1
d4ac4e33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+6
-4
No files found.
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
3a323e22
...
@@ -111,7 +111,12 @@ of the :func:`cythonize` function.
...
@@ -111,7 +111,12 @@ of the :func:`cythonize` function.
Declare a var with the wrapped C++ class
Declare a var with the wrapped C++ class
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Now, we use cdef to declare a var of the class with the C++ ``new`` statement:
We'll create a ``.pyx`` file named ``rect.pyx`` to build our wrapper. We're
using a name other than ``Rectangle``, but if you prefer giving the same name
to the wrapper as the C++ class, see the section on
:ref:`resolving naming conflicts <resolve-conflicts>`.
Within, we use cdef to declare a var of the class with the C++ ``new`` statement:
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/cython_usage.pyx
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/cython_usage.pyx
...
@@ -164,9 +169,6 @@ instance.
...
@@ -164,9 +169,6 @@ instance.
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/rect_ptr.pyx
.. literalinclude:: ../../examples/userguide/wrapping_CPlusPlus/rect_ptr.pyx
If you prefer giving the same name to the wrapper as the C++ class, see the
section on :ref:`resolving naming conflicts <resolve-conflicts>`.
Compilation and Importing
Compilation and Importing
=========================
=========================
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment