Python:cffi
Example
설치하기:
c 라이브러리 연결:
from cffi import FFI
ffibuilder = FFI()
ffibuilder.cdef("""
double sqrt(double x);
""")
ffibuilder.set_source("_libmath",
"""
#include <math.h>
""",
library_dirs = [],
libraries = ['m']
)
ffibuilder.compile(verbose=True)
ffibuilder.compile
를 마지막에 호출해야 python 링크 가능한 공유 라이브러리가 생성된다.
라이브러리 사용: