From c2f3f280bcfd82618590e9872ddce19b56940ab0 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 24 Sep 2021 22:41:45 +0800 Subject: add swig.c and swig.cpp rules --- tests/projects/swig/python_c/src/example.c | 14 ++++++++++++++ tests/projects/swig/python_c/src/example.i | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/projects/swig/python_c/src/example.c create mode 100644 tests/projects/swig/python_c/src/example.i (limited to 'tests/projects/swig/python_c/src') diff --git a/tests/projects/swig/python_c/src/example.c b/tests/projects/swig/python_c/src/example.c new file mode 100644 index 000000000..31c659bfa --- /dev/null +++ b/tests/projects/swig/python_c/src/example.c @@ -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_c/src/example.i b/tests/projects/swig/python_c/src/example.i new file mode 100644 index 000000000..34193edc7 --- /dev/null +++ b/tests/projects/swig/python_c/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); -- cgit v1.3.1