IPB

> Writing DLLs
Чат
Форум
Загрузка...
 

Язык:
Русский
English

 Writing DLLs


The structure of a Borland Pascal DLL is identical to that of a program, except that a DLL starts with a library header instead of a program header.

The library header tells Borland Pascal to produce an executable file with the extension .DLL instead of .EXE. It also ensures that the executable file is marked as being a DLL.

If procedures and functions are to be exported by a DLL, they must be compiled with the export procedure directive.

Example

This implements a very simple DLL with two exported functions:

   library MinMax;

   {The export procedure directive prepares Min and Max for exporting}

   function Min(X, Y: Integer): Integer; export;
   begin
     if X < Y then Min := X else Min := Y;
   end;

   function Max(X, Y: Integer): Integer; export;
   begin
     if X > Y then Max := X else Max := Y;
   end;

   {The exports clause actually exports the two routines, supplying an
    optional ordinal number for each of them}

   exports
     Min index 1,
     Max index 2;

   begin
   end.

Libraries often consist of several units. In such cases, the library source file itself is frequently reduced to a uses clause, an exports clause, and the library's initialization code.

For example:

   library Editors;

   uses EdInit, EdInOut, EdFormat, EdPrint;

   exports
     InitEditors index 1,
     DoneEditors index 2,
     InsertText index 3,
     DeleteSelection index 4,
     FormatSelection index 5,
     PrintSelection index 6,
      .
      .
     SetErrorHandler index 53;

   begin
     InitLibrary;
   end.

See Also

 
 К началу страницы 
 

Код для вставки: :: :: :: ГОСТ ::
Поделиться: //
 



-
Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"