Replace running dll

Posted on 2011-05-02
Last Modified: 2012-05-11

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.
Question by:Delphiwizard
    LVL 19

    Expert Comment

    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
    LVL 24

    Expert Comment

    You can try the function MoveFileEx to replace the DLL with the new after providing the paths to both of them.
    LVL 24

    Expert Comment

    Hi Thommy, long time man. Where have you been?
    LVL 36

    Accepted Solution

    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

    Author Closing Comment

    Thank you very much.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now