CFFI是否不加载依赖库? [英] CFFI Not Loading Dependent Libraries?

查看:110
本文介绍了CFFI是否不加载依赖库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用SBCL中的BLAS / LAPACK库(特别是尝试获取 LLA 包正在运行)。加载BLAS共享库时遇到很多麻烦;最终,我发现它无法加载其依赖库。最终我能够通过手动加载所有依赖项来加载BLAS:

I am trying to use the BLAS/LAPACK libraries from SBCL (specifically trying to get the LLA package running). I was having a lot of troubles getting the BLAS shared library to load; eventually I discovered that it wasn't able to load its dependent libraries. Eventually I was able to load BLAS by loaded all of its dependencies manually:

(setq cffi::*foreign-library-directories* '("C:/cygwin64/bin/" "C:/cygwin64/lib/lapack/"))
(CFFI:LOAD-FOREIGN-LIBRARY "CYGWIN1.DLL")
(CFFI:LOAD-FOREIGN-LIBRARY "CYGGCCC_S-SEH-1.DLL")
[..etc..]
(CFFI:LOAD-FOREIGN-LIBRARY "CYGBLAS-0.dll")

作为一种解决方法,这并不可怕,但是我不明白为什么CFFI:LOAD-FOREIGN-LIBRARY并非如此能够查找和加载依赖项本身。我做错了吗?

As a workaround this isn't terrible, but I don't understand why CFFI:LOAD-FOREIGN-LIBRARY is not able to find and load the dependencies itself. Am I doing something wrong?

推荐答案

在您的情况下,可能不是CFFI,而是使这种情况发生的Windows DLL搜索规则

In your case it's probably not CFFI but Windows DLL search rules that make this happen.

code> cygblas-0.dll 在 c:\cygwin64\lib\lapack 目录中,从同一目录,当前目录,Windows目录和 PATH 中搜索。

As cygblas-0.dll is in the c:\cygwin64\lib\lapack directory, any dependencies it may have are searched from that same directory, the current directory, Windows directories, and from PATH.

如果在路径中没有 c:\cygwin64\bin 时,找不到DLL。 cffi :: * foreing-library-directories * 不影响Windows功能; CFFI只需执行对 LoadLibrary 以及指向DLL的完整路径。

If you do not have c:\cygwin64\bin in your path, the DLLs cannot be found. cffi::*foreing-library-directories* does not affect the Windows functionality; CFFI simply executes a call to LoadLibrary with a full path to the DLL.

作为解决方案,建议您配置 PATH 包含 c:\cygwin64\bin 目录,无论如何这都是一个好主意。或者,您可以在调用 load-foreign-library 之前修改代码中的 PATH 环境变量,但是< href = http://cl-cookbook.sourceforge.net/os.html#env rel = nofollow>完成的方式取决于实现方式。

As a solution, I suggest you configure your PATH to include the c:\cygwin64\bin directory, which is a good idea in any case. Alternatively, you could modify the PATH environment variable in your code before the call to load-foreign-library, but the way it's done is implementation dependent.

这篇关于CFFI是否不加载依赖库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆