Replace running dll


As the version of the MySQL databaseserver is changing, I need to upgrade the libmysql.dll mon the customer machine (this is either a Windows laptop/desktop of a Windows server).
The libmysql.dll is currentlt in use.

How can I replace the dll anyway from within my delphi application.
Stef MerlijnDeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The dll must be unloaded to replace it from within your application.

If you use static dll loading, the dll is always loaded, when your application is started. Therefore you cannot replace it.

Load you dll dynamically, so you can replace it, when it is not in use...

Dynamic Link Libraries (DLL) and Delphi
You can try the function MoveFileEx to replace the DLL with the new after providing the paths to both of them.
Hi Thommy, long time man. Where have you been?
Geert GOracle dbaCommented:
you can not do that, if you're application is not the only one using it

the quick and dirty way ...
rename the dll
copy the new in the same location

newly started apps will use the new dll

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Stef MerlijnDeveloperAuthor Commented:
Thank you very much.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.