I\'m new to Cython and I\'m trying to use Cython to wrap a C/C++ static library. I made a simple example as follow.
Test.h:
#ifndef
Your Test.pyx file isn't doing what you expect. The print add(2,3) line will not call the add() C++ function; you have to explicitly create a wrapper function to do that. Cython doesn't create wrappers for you automatically.
Something like this is probably what you want:
cdef extern from "test.h":
int _add "add"(int a,int b)
int _multiply "multiply"(int a,int b)
def add(a, b):
return _add(a, b)
def multiply(a, b):
return _multiply(a, b)
print add(2, 3)
You can look at Cython's documentation for more details.