Sobald ich eine Funktion der
DLL im Code implementiere lädt die
DLL automatisch.
Und wie ist diese Funktion implementiert?
Delphi-Quellcode:
procedure TraceDebug(Msg: PWideChar); stdcall;
function Trace(Tmp: PWideChar): LongInt; stdcall;
Delphi-Quellcode:
library Tracer;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
uses
Windows,
SysUtils,
Global
in '
Global.pas',
uIni
in '
uIni.pas';
{$R *.res}
procedure LibraryProc(Reason: integer);
begin
case (Reason)
of
//DLL_PROCESS_ATTACH:
// Trace('Trace Init'); // DLL Funktion aufgerufen bevor ich die geladen habe, also deaktiviert.
DLL_PROCESS_DETACH:
begin
if gnBackBrush <> 0
then
begin
DeleteObject(gnBackBrush);
gnBackBrush := 0;
end;
TraceDebug('
');
end;
end;
end;
exports
Trace,
TraceDebug;
begin
DLLProc := @LibraryProc;
DLLProc(DLL_PROCESS_ATTACH);
end.
Hat sich erledigt siehe Kommentar.