Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我最近一直在玩 Python 中相当优秀的 ctypes 库。我想知道的是,是否可以创建共享D库并以相同的方式调用它们。我假设我会使用with编译.so文件或使用库以相同的方式调用它们。-fPICdmdgdcctypes
D
.so
-fPIC
dmd
gdc
ctypes
有没有人试过这个?看起来好像UNIX部分支持共享库。
UNIX
非常感谢,
铝。
在这种情况下,Windows dll 应该可以正常工作。我不确定 Linux 上的情况,共享库存在一些问题,这些问题将在 dmd 的 64 位端口完成后立即解决。
请注意,您必须将函数导出为 extern(C) 或 extern(Windows) 才能从 ctypes 访问它们。