cython-example:将 Cython 链接到本地​​ C 库

时间:2021-06-25 06:55:08
【文件属性】:
文件名称:cython-example:将 Cython 链接到本地​​ C 库
文件大小:7KB
文件格式:ZIP
更新时间:2021-06-25 06:55:08
Shell 使用 Cython 链接到 C-Library 的示例 此示例演示了 C 库如何链接到 Cython 库以及它在哪里失败。 此演示用于教育目的,也应作为讨论的基础。 编译和测试: cd a_lib make cd ../cython-project bash test.sh 洞察力 当您不想在/usr/lib或其他系统文件夹中安装非 cython 共享库时, LD_LIBRARY_PATH问题会使动态链接成为一种糟糕的体验。 将该库的目标文件静态链接到您的 cython 库中确实有效,但是这些符号不能像人们期望的那样通过cimport与其他库cimport 。 这样做的根本原因是,extern 函数声明保留了原始名称(如在 C 中),相比之下,Cython-cdef-functions 是名称错位的。 cdef return_42 (): return 42 例如,在_
【文件预览】:
cython-example-master
----.gitignore(15B)
----README.rst(1KB)
----a_lib()
--------Makefile(138B)
--------foo.h(132B)
--------foo.c(60B)
----cython-project()
--------c_from_with_direct_compilation_user.pyx(67B)
--------setup.py(1KB)
--------c_bar.pyx(42B)
--------test.sh(2KB)
--------c_from_with_direct_compilation.pxd(61B)
--------c_misc.pyx(63B)
--------c_with_ptrs.pyx(63B)
--------c_misc_with_ptrs.pyx(75B)
--------c_foo.pyx(42B)
--------c_foo.pxd(55B)
--------c_from.pyx(37B)
--------c_from_user.pyx(67B)
--------c_bar.pxd(42B)
--------c_from_with_direct_compilation.pyx(44B)
--------c_from.pxd(84B)
--------c_with_ptrs.pxd(75B)

网友评论