2

I am writing a portable application that connects to both a firebird database and a mysql database. I am writing the application in Delphi 2010, and using dbExpress components to connect to both databases. SQLconnection component uses dbxmys.dll and libmysql.dll for the mysql database, and dbxfb.dll and fbclient.dll for the firebird database.

On my development computer I had to move the dll files into /windows/system/. I think this is because of the system paths, in order to find the correct files and connect. I tried this on another client machine, and the software could not connect because the dll files were not found. Because this is a portable application I do not want to include a sub directory of the application directory to include the dll files, however I do not think the a client machine can run the applicaiton without having mySQL and Firebird installed and the pathing set correctly.

Is there a better way to do this? I have concidered making a sub directory and forcing my application to look there, (since firebird and mySQL can be installed anywhere) if they were included I would know for sure were they were at on any computer my app is launched from. But I don't really want to take this approach.

What are my options as far as direct db connection, or solving the dll requirement problem, I am not an experienced software developer. Thanks in advance.

Update: The DLLs are now in the same directory with the exe, and the application launches fine. I Still do not want to use any dlls. I have found a few components that do not require dlls, but they also require payment, finding another free option would be ideal.

4

1 回答 1

1

您可以做的是将 .dll 作为压缩资源存储在主 .exe 中,然后将它们展开到本地文件夹(例如本地“应用程序数据”),然后从那里执行库。因此,您不需要将文件放在系统路径中(可能具有管理员权限),也不需要更改路径本身。

因此,您不需要将 .dll 与 .exe 一起复制,如果 .dll 已经可用,您的应用程序将使用它们。.exe 文件夹不会被库文件“污染”,您的软件仍然可以自行安装:如果您将 .exe 复制到另一台计算机,您仍然有 .dll,可以安装在其中一个隐藏的本地文件夹。

例如,我们的SynProject 工具如何使用 Hunspell 库进行拼写检查。看到这个答案

于 2013-02-09T19:59:56.653 回答