?
Solved

Replace running dll

Posted on 2011-05-02
5
Medium Priority
?
295 Views
Last Modified: 2012-05-11
Hi,

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.
0
Comment
Question by:Stef Merlijn
5 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 35505515
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
http://delphi.about.com/od/windowsshellapi/a/delphi-dll-loading-static-dynamic.htm
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35505529
You can try the function MoveFileEx to replace the DLL with the new after providing the paths to both of them.
0
 
LVL 24

Expert Comment

by:jimyX
ID: 35505541
Hi Thommy, long time man. Where have you been?
0
 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 2000 total points
ID: 35511867
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
0
 

Author Closing Comment

by:Stef Merlijn
ID: 35511914
Thank you very much.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

807 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