summaryrefslogtreecommitdiff
path: root/tests/projects/swig/python_cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'tests/projects/swig/python_cpp/src')
-rw-r--r--tests/projects/swig/python_cpp/src/example.cpp14
-rw-r--r--tests/projects/swig/python_cpp/src/example.i11
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/projects/swig/python_cpp/src/example.cpp b/tests/projects/swig/python_cpp/src/example.cpp
new file mode 100644
index 000000000..31c659bfa
--- /dev/null
+++ b/tests/projects/swig/python_cpp/src/example.cpp
@@ -0,0 +1,14 @@
+double My_variable = 3.0;
+
+/* Compute factorial of n */
+int fact(int n) {
+ if (n <= 1)
+ return 1;
+ else
+ return n*fact(n-1);
+}
+
+/* Compute n mod m */
+int my_mod(int n, int m) {
+ return(n % m);
+}
diff --git a/tests/projects/swig/python_cpp/src/example.i b/tests/projects/swig/python_cpp/src/example.i
new file mode 100644
index 000000000..34193edc7
--- /dev/null
+++ b/tests/projects/swig/python_cpp/src/example.i
@@ -0,0 +1,11 @@
+%module example
+%{
+/* Put headers and other declarations here */
+extern double My_variable;
+extern int fact(int);
+extern int my_mod(int n, int m);
+%}
+
+extern double My_variable;
+extern int fact(int);
+extern int my_mod(int n, int m);