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
Xavier Thompson
cython
Commits
37486422
Commit
37486422
authored
Aug 22, 2011
by
Angus McMorland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated/fixed rectangle example files (Rectangle.cpp and rectangle.pyx)
parent
f54a0301
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
docs/src/userguide/wrapping_CPlusPlus.rst
docs/src/userguide/wrapping_CPlusPlus.rst
+11
-9
No files found.
docs/src/userguide/wrapping_CPlusPlus.rst
View file @
37486422
...
@@ -65,6 +65,8 @@ and the implementation in the file called :file:`Rectangle.cpp`:
...
@@ -65,6 +65,8 @@ and the implementation in the file called :file:`Rectangle.cpp`:
#include "Rectangle.h"
#include "Rectangle.h"
using namespace shapes;
Rectangle::Rectangle(int X0, int Y0, int X1, int Y1)
Rectangle::Rectangle(int X0, int Y0, int X1, int Y1)
{
{
x0 = X0;
x0 = X0;
...
@@ -109,15 +111,15 @@ In Cython :file:`setup.py` scripts, one normally instantiates an Extension
...
@@ -109,15 +111,15 @@ In Cython :file:`setup.py` scripts, one normally instantiates an Extension
object. To make Cython generate and compile a C++ source, you just need
object. To make Cython generate and compile a C++ source, you just need
to add the keyword ``language="c++"`` to your Extension construction statement, as in::
to add the keyword ``language="c++"`` to your Extension construction statement, as in::
ext = Extension(
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(ext_modules=[Extension(
"rectangle", # name of extension
"rectangle", # name of extension
["rectangle.pyx", "Rectangle.cpp"], # filename of our Cython source
["rectangle.pyx", "Rectangle.cpp"], # our Cython source
language="c++", # this causes Cython to create C++ source
language="c++")], # causes Cython to create C++ source
include_dirs=[...], # usual stuff
cmdclass={'build_ext': build_ext})
libraries=["stdc++", ...], # ditto
extra_link_args=[...], # if needed
cmdclass = {'build_ext': build_ext}
)
Cython will generate and compile the :file:`rectangle.cpp` file (from the
Cython will generate and compile the :file:`rectangle.cpp` file (from the
:file:`rectangle.pyx`), then it will compile :file:`Rectangle.cpp`
:file:`rectangle.pyx`), then it will compile :file:`Rectangle.cpp`
...
...
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