I want to unload unused sqlncli.dll.
Code like this:
Code: Select all
procedure TForm1.Button1Click(Sender: TObject);
begin
MSConnection1.Open;
MSConnection1.Close;
CoFreeUnusedLibrariesEx(200, 0);
Sleep(300);
CoFreeUnusedLibrariesEx(200, 0);
end;
I have version of sqlncli.dll = 2005.90.4035.0. Address of global var is $33999480. You can see it in first instuction of DllCanUnloadNow in CPU window like this:
Code: Select all
sqlncli.DllCanUnloadNow:
338C10F2 833D8094993300 cmp dword ptr [$33999480],$00
....
I found that ref count increment on call Uninitialize method of IDBInitialize in this code:
Code: Select all
procedure TOLEDBConnection.Disconnect;
begin
if FConnected then begin
if FNativeConnection then begin
if FIDBInitialize nil then
FIDBInitialize.Uninitialize;// check not need
ReleaseInterfaces;
end;
FConnected := False;
FreeAndNil(FColumnsMetaInfo);
FreeAndNil(FColumnsRowsetFieldDescs);
end;
end;
Thanks.