Hi I was trying to wrap a simple C source code consisting of two .C Source files (files attached).
I adapted the (very) simple example from the documentation getting to this:
import os from cffi import FFI blastbuilder = FFI() ffibuilder = FFI() with open(os.path.join(os.path.dirname(__file__), "c-src/blast.c")) as f: blastbuilder.set_source("blast", f.read(), libraries=["c"]) with open(os.path.join(os.path.dirname(__file__), "c-src/blast.h")) as f: blastbuilder.cdef(f.read()) blastbuilder.compile(verbose=True) with open('c-src/dbc2dbf.c','r') as f: ffibuilder.set_source("_readdbc", f.read(), libraries=["c"]) with open(os.path.join(os.path.dirname(__file__), "c-src/blast.h")) as f: ffibuilder.cdef(f.read(), override=True) if __name__ == "__main__": # ffibuilder.include(blastbuilder) ffibuilder.compile(verbose=True)
However when it compiles it does not link both blast.o and _readdbc.o into a single .so it compiles only _readdbc, and when I try to import _readdbc, it gives me an import error, saying it can find blast. If I do it by hand, I can import _readdbc, but I don’t see any of the functions declared in dbc2dbf.c
Maybe I am doing something stupid, but I couldn't find any example that illustrated a case of wrapping similar to mine. In any case, my knowledge of C is very limited. So I apologize in advance for any stupid mistake.
Lastly, I know this not the best place to ask such a question. But maybe this little problem can become a documentation issue.