[capi-sig] Compiling/Linking external Functions (setup.py, distutils, gcc?)
philipp at achtziger.de
Wed Nov 19 18:00:11 CET 2008
I would like to use an existing C-Function from python. Therfore I made
up an wrapper (wrap.c), where all the variable transformations from
Python to C are done. That works. Now I would like to call the external
fuction, which is placed in lets say ext_foo.a with a corresponding
ext_foo.h and can be used as a library from plain C.
I am assuming, that I do have to include the ext_foo.h in my wrap.c with
that I have to introduce the function in my C-Code:
extern int foo(int);
that I have to tell the setup.py using the distutils stuff where the
library can be found...
when compiling a C-Code which is not for python usage I do type
gcc -o test.o ./test.c ./ext_foo.a -I./foo_h_file_path/
and everything is fine,
where within these setup.py files do I have to mention the ./ext_foo.a ?
When I do place it in the sources-tag, setup procedure complains that it
doesn't know any .a files... if I don't mention it explicitly, just
giving the include_dirs, compilation works fine, but when importing from
python 'import wrap' I do get the message: Symbol not found: _foo
Any help is very much appreciated!
More information about the capi-sig