Eksport z DLL

0

Jak wywołać procedury programu z biblioteki DLL ???

0

Jak wywołać procedury programu z biblioteki DLL ???

nie kumam pytania........
chcesz w programie uzywac procedur z DLL? opis jak tworzyc DLL, komunikacja procedur z DLL do programu masz w Artykulach.
Jesli masz nieudokumentowana bib. DLL (np. sciagniete) to ciezko bedzie znalezc jakie sa tam procki (ale chyba nie niemozliwe ;))

0

na przykład tak:

function OpenThread(dwDesiredAccess: DWORD; bInheritHandle: BOOL; dwProcessId: DWORD): THandle; stdcall; external kernel32 name 'OpenThread';

ale możesz tak zrobić tylko, jeśli wiesz, jakie parametry przyjmuje i zwraca funkcja.

0

To była wersja statyczna, istnieje też wersja dynamiczna. Przykład:

TBasicStatsEstim=function (const Data : array of double;
  out Mean, Variance, StDev, Skewness, Kurtosis, CV, Max, Min: double
  ): Boolean; stdcall;

var
  BasicStatsEstim:TBasicStatsEstim;


  DllHandle:=LoadLibrary('stats.dll');
  if DllHandle=0 then
   begin
     ShowMessage('stats.dll not found');
     Application.Terminate;
   end;

  @BasicStatsEstim:=GetProcAddress(DllHandle,'BasicStatsEstim');

  if  @BasicStatsEstim=nil
  then
   begin
     ShowMessage('Wrong or corrupted stats.dll');
     Application.Terminate;
   end;
0

czyżbym nie nadążał za rozwojem Delphi? co to za operator out?

0

F1

An out parameter, like a variable parameter, is passed by reference. With an out parameter, however, the initial value of the referenced variable is discarded by the routine it is passed to. The out parameter is for output only; that is, it tells the function or procedure where to store output, but doesn't provide any input.

For example, consider the procedure heading

procedure GetInfo(out Info: SomeRecordType);

When you call GetInfo, you must pass it a variable of type SomeRecordType:

var MyRecord: SomeRecordType;
...
GetInfo(MyRecord);

But you're not using MyRecord to pass any data to the GetInfo procedure; MyRecord is just a container where you want GetInfo to store the information it generates. The call to GetInfo immediately frees the memory used by MyRecord, before program control passes to the procedure.

Out parameters are frequently used with distributed-object models like COM and CORBA. In addition, you should use out parameters when you pass an uninitialized variable to a function or procedure.

1 użytkowników online, w tym zalogowanych: 0, gości: 1