DLL u Delphi

DLL u Delphi

offline
  • Gama  Male
  • Zaslužni građanin
  • istoričar
  • Pridružio: 14 Jun 2004
  • Poruke: 691
  • Gde živiš: Niš, Srbija

Moze li neko da da osnovne informacije za pravljenje DLL-ova u Delphi..
Neki tutorijal i slicno..
Hitno mi je potreban...



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • Srđan Tot
  • Am I evil? I am man, yes I am.
  • Pridružio: 12 Jul 2005
  • Poruke: 2483
  • Gde živiš: Ljubljana

Citat:Delphi Help:

The main source for a dynamically loadable library is identical to that of a program, except that it begins with the reserved word library (instead of program).

Only routines that a library explicitly exports are available for importing by other libraries or programs. The following example shows a library with two exported functions, Min and Max.

library MinMax;
function Min(X, Y: Integer): Integer; stdcall;
begin
if X < Y then Min := X else Min := Y;
end;
function Max(X, Y: Integer): Integer; stdcall;
begin
if X > Y then Max := X else Max := Y;
end;
exports
Min,
Max;
begin
end.

If you want your library to be available to applications written in other languages, it's safest to specify stdcall in the declarations of exported functions. Other languages may not support Delphi's default register calling convention.

Note

If your application includes VisualCLX components, you must use packages instead of DLLs or shared objects. Only packages can manage the startup and shutdown of the Qt shared libraries.

Libraries can be built from multiple units. In this case, the library source file is frequently reduced to a uses clause, an exports clause, and the initialization code. For example,

library Editors;
uses EdInit, EdInOut, EdFormat, EdPrint;
exports
InitEditors,
DoneEditors name Done,
InsertText name Insert,
DeleteSelection name Delete,
FormatSelection,
PrintSelection name Print,
...
SetErrorHandler;
begin
InitLibrary;
end.

You can put exports clauses in the interface or implementation section of a unit. Any library that includes such a unit in its uses clause automatically exports the routines listed the unit's exports clauses--without the need for an exports clause of its own.

The directive local, which marks routines as unavailable for export, is platform-specific and has no effect in Windows programming.

On Linux, the local directive provides a slight performance optimization for routines that are compiled into a library but are not exported. This directive can be specified for stand-alone procedures and functions, but not for methods. A routine declared with local--for example,

function Contraband(I: Integer): Integer; local;

does not refresh the EBX register and hence

cannot be exported from a library.
cannot be declared in the interface section of a unit.
cannot have its address taken or be assigned to a procedural-type variable.
if it is a pure assembler routine, cannot be called from another unit unless the caller sets up EBX.


Porgledaj malo help... sve je lepo i detaljno objasnjeno.



Ko je trenutno na forumu
 

Ukupno su 795 korisnika na forumu :: 4 registrovanih, 1 sakriven i 790 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: kovinacc, MikeHammer, MILO-VAN, yrraf