无论我将其重命名为什么,Python、PyQT、QT 或 Windows Vista 都会找到我的 dll。这是正常的吗?
我正在试验 PyQT,我试图弄清楚如何让它与 Firebird 一起工作。我构建了 Firebird 驱动程序,但无法让它工作,所以我想也许我没有把它放在正确的位置。所以我尝试使用 SQLite 驱动程序进行实验,因为 PyQT 已经安装了它并提供了工作示例。我想如果我重命名了我能找到的所有 qsqlite4.dll 驱动程序文件,最终当我重命名它实际使用的驱动程序时,示例程序将停止工作。那行不通。所以我尝试将“site-packages\pyqt4\plugins\sqldrivers”文件夹重命名为“site-packages\pyqt4\plugins\sqldrivers-old”,然后就成功了。示例程序停止运行。所以我把文件夹名称改回来,并尝试重命名文件夹中的所有文件。但示例程序又开始工作了。然后我将 qsqlite4.dll 文件移动到一个子目录,它停止工作。所以我把它移回来,并将其重命名为 blah.blah.blah。它又起作用了。然后我用 notepad++ 打开 blah.blah.blah,并删除了文件顶部的一些内容,这使得示例程序无法运行。所以我很困惑。据我所知,Python、PyQT、QT 或 Windows Vista 都可以找到该 dll,无论我将其重命名为什么,只要它位于正确的文件夹中即可。我什至尝试将其重命名为其他 dll 之一的名称,认为这可能会让它感到困惑。但这只是让我困惑。这是正常的吗?
编辑:我认为这与插件有关
I'm experimenting with PyQT, and I was trying to figure out how to get it to work with Firebird. I built the Firebird driver, but couldn't get it to work, so I was thinking maybe I wasn't putting it in the right place. So I tried experimenting with the SQLite driver, since PyQT came with it already installed, with working examples. I figured if I renamed all the qsqlite4.dll driver files I could find, eventually the example program would stop working when I renamed the one it was actually using. That didn't work. So I tried renaming the "site-packages\pyqt4\plugins\sqldrivers" folder to "site-packages\pyqt4\plugins\sqldrivers-old", and that did it. The example program stopped working. So I changed the folder name back, and tried renaming all the files in the folder. But the example program started working again. Then I moved the qsqlite4.dll file to a subdirectory, and it stopped working. So I moved it back, and renamed it to blah.blah.blah. And it worked again. Then I opened up blah.blah.blah with notepad++, and deleted some stuff at the top of the file, and that kept the example program from working. So I'm confused. As far as I can tell, either Python, PyQT, QT, or Windows Vista is finding the dll, no matter what I rename it to, as long as it's in the right folder. I even tried renaming it to the name of one of the other dll's, thinking maybe that would confuse it. But it only confused me. Is this normal?
edit: I'm thinking this has something to do with plugins
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,Qt 插件基础设施是一个相当简单且强大的基础设施。
它尝试加载 sqldrivers 目录中的每个文件。如果成功,每个 dll 都会运行一个函数来注册此类插件支持的所有功能。
然后,您的应用程序将初始化。如果它需要的所有功能都可用,则它可以正常工作,否则,会发生某种形式的错误或异常处理。
Yes, Qt plugin infrastructure is a fairly simple and robust one.
It attempts to load every file in sqldrivers directory. If it is successful, each dll then runs a function that registers all the features such a plugin supports.
Then, you application initalizes. If all the features it needs are available, it works properly, otherwise, some form of error or exception handling occurs.