Форум: "Основная";
Текущий архив: 2002.01.08;
Скачать: [xml.tar.bz2];
ВнизDLL S Найти похожие ветки
← →
Oleg Gashev (2001-12-15 18:35) [1]Calling DLLs
Topic group See also
Before you can call routines defined in a DLL, you must import them. This can be done in two ways: by declaring an external procedure or function, or by calling the Windows API directly. Whichever method you use, the routines are not linked to your application until runtime. This means that the DLL need not be present when you compile your program. It also means that there is no compile-time validation of attempts to import a routine.
Object Pascal does not support importing of variables from DLLs.
Static loading
The simplest way to import a procedure or function is to declare it using the external directive. For example,
procedure DoSomething; external "MYLIB.DLL";
If you include this declaration in a program, MYLIB.DLL is loaded once, when the program starts. Throughout execution of the program, the identifier DoSomething always refers to the same entry point in the same DLL.
Declarations of imported routines can be placed directly in the program or unit where they are called. To simplify maintenance, however, you can collect external declarations into a separate “import unit” that also contains any constants and types required for interfacing with the DLL. (Delphi’s Windows unit is a good example.) Other modules that use the import unit can call any routines declared in it.
For more information about external declarations, see External declarations .
Dynamic loading through Windows API calls.
Страницы: 1 вся ветка
Форум: "Основная";
Текущий архив: 2002.01.08;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.006 c