我尝试过的(在 Windows 上运行 Tcl 和 Tk 8.6.0):
load D:/toot/bar/em.dll
load "D:/toot/bar/em.dll"
load D://toot//bar//em.dll
load "D://toot//bar//em.dll"
load D:\toot\bar\em.dll
load "D:\toot\bar\em.dll"
load D:\\toot\\bar\\em.dll
load "D:\\toot\\bar\\em.dll"
所有这些都会返回以下两个错误之一:
couldn't load library [what I put after 'load']: invalid argument
couldn't load library [what I put after 'load', rendered]: this library or a dependent library could not be found in library path
最佳答案
假设文件存在D:/toot/bar/em.dll
返回truea,加载D:/toot/bar/em.dll
应该可以。但是,听起来您在该库所依赖的事物(即其他 DLL)方面遇到了问题。
这是 Windows 上的一个常见问题,已被 asked elsewhere on Stack Overflow ;那里的答案与这个问题相关。您还应该注意,如果 DLL 已链接到特定版本的 Tcl DLL(不建议在 Windows 上使用 Tcl 扩展),那么您需要安装与原来版本相同的 Tcl链接反对。支持 stub 的扩展根本不存在这个问题(尽管它们仍然会遇到缺少其他所需库的问题)。
遗憾的是,load
命令没有告诉您错误消息中缺少哪个 DLL,而且 IIRC 底层操作系统 API 也没有报告它。您不得不使用外部工具来诊断这些事情......
a 不要担心反斜杠/正斜杠问题; Tcl 会为您处理这些事情。
关于dll - 如何在Tcl中加载dll?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18171997/