Код:
library test;
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
procedure MyFirstDLLProc(Reason: Integer);
begin
if Reason = DLL_PROCESS_ATTACH then
begin
showmessage('Hello World!');
end;
if Reason = DLL_PROCESS_DETACH then
begin
showmessage('Bye World!');
end;
end;
begin
DLLProc := @MyFirstDLLProc;
MyFirstDLLProc(DLL_PROCESS_ATTACH);
end.
Вот же.