Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "KOL";
Текущий архив: 2006.04.09;
Скачать: [xml.tar.bz2];

Вниз

KOL + freelibrary   Найти похожие ветки 

 
Riton   (2005-08-12 21:29) [0]

Hello,

I have a problem to use freelibrary to unload my dll dynamicly.

Here is the code :

var
DLL:HWD;

DLL := LoadLibrary(PChar("MyDLL.dll"));
 if DLL <> 0 then begin
   try
     MyFunction := GetProcAddress(DLL, "MyFunction");
     if assigned(MyFunction) then begin
   result:=MyFunction;
     end
     else ShowMessage("Function is not found in the dll");
   finally
FreeLibrary(DLL); // => PROBLEM !
  end;
 end
 else showmessage("The DLL "MyDLL" is not found");
end;

Where is the mistake please ? Why is it not possible to unload the dll at the place where the problem is ?

Thank you very much for your help.

Best regards.
Riton.


 
Dodfr   (2005-08-12 22:50) [1]

are you sure it is not the DLL itself that crash when it is freed ?


 
thaddy   (2005-08-13 01:05) [2]

Freelibrary(&#39;MyLibrary.dll&#39;), perhaps? ;)
Otherwise it is already unloaded by the operating system, or not part of YOUR application ;)


 
Alexander Panov ©   (2005-08-13 04:56) [3]

Why KOL?
Read commentary Wizard DLL?


 
Riton   (2005-08-13 12:19) [4]

Problem solved.

Thank you very much Dodfr and Alexander. I had forgotten to add sharemem to uses in then application and in then dll.

I found heapmm on kol site (downloads > Adds) which do the same thing and does not require a dll. It is wonderful. I recommend it to you !

Bye.
Riton.


 
Thaddy   (2005-08-14 11:42) [5]

Even better is FastMM4, available from tha fastcode project (rumoured to be the "official" memory manager in D2006), which does the same as HeapMM. Gives a bit larger code, though, but more stable and a lot faster than the heapMM.


 
L505   (2005-08-17 13:20) [6]

What you are passing between the DLL and the program?

You shouldn"t have to use sharemem unless you are passing ansistrings, dynamic arrays, or other "Automatic Types" across module boundries. i.e. if you use pchars, fixed arrays, records of pchars and fixed arrays, integers, it is okay.



Страницы: 1 вся ветка

Форум: "KOL";
Текущий архив: 2006.04.09;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.012 c
2-1143104010
Виктор1123
2006-03-23 11:53
2006.04.09
Начал изучать БД...


1-1141725066
balepa
2006-03-07 12:51
2006.04.09
Открыть документ (изменить) Excel из потока


15-1142327888
Creative
2006-03-14 12:18
2006.04.09
Существует ли версия Дельфи для КПК?


2-1143105289
Der Nechk@ssoff
2006-03-23 12:14
2006.04.09
Сканирование папки


15-1142928167
Petrovski
2006-03-21 11:02
2006.04.09
Неужели Delphi на этом и закончится?





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский