DLL 을 이용할 때 dll 이 로딩되는지 언로딩 되는지 알 수 있다.
Library testdll;
Library testdll;
http://www.delphifaq.com/faq/delphi_windows_API/f534_0.htm
The code snippet shows how your DLL can track its usage.
uses
Windows, // DLL_PROCESS_nnn defined in here
SysUtils, Classes;
procedure MyDLLProc(Reason: Integer);
begin
case Reason of
DLL_PROCESS_ATTACH: // called when the DLL is loaded
begin
end;
DLL_PROCESS_DETACH: // called when the DLL is freed, if you want
// multithreaded, look at DLL_THREAD_DETACH
begin
end;
end;
end;
begin
DLLProc := @MyDLLProc; // this sets the DLL entry point to the MyDLLProc.
// when ever the DLL is loaded or unloaded,
// this proc is called with:
// DLL_PROCESS_ATTACH
// DLL_PROCESS_DETACH
// DLL_THREAD_ATTACH
// DLL_THREAD_DETACH
MyDLLProc(DLL_PROCESS_ATTACH); // because we interupted the default
// dllproc, we must recall our proc
// with the DLL_PROCESS_ATTACH reason.
end.
반응형
'Delphi, RadStudio' 카테고리의 다른 글
[개발/delphi] how to have an exe file delete itself (0) | 2011.12.12 |
---|---|
[개발/delphi] 외부 프로그램 실행하고 기다리기 Execute and wait (0) | 2011.12.12 |
[개발/delphi] RLINK 32: out of memory (0) | 2011.12.12 |
[Delphi] IdHTTP로 세션아이디를 포함하여 요청하기 (SessionID) (0) | 2011.12.09 |
[delphi] 브라우저 링크 프로토콜 정의하기 (0) | 2011.12.09 |
댓글