Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];
Down
Dll s Find similar branches
← →
HELP ME PLZ (2001-12-15 18:22) [0]HELP ME PLEASE I FIRST TIME WORKING WITH A DLL HOW TO CALL A FUNCTION FROM A DLL-shki
← →
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 by calling the Windows API directly. Whichever method you use is not linked to your application; You need to compile your program. It also means that you are trying to import a routine.
Object Pascal does not support importing of variables from DLLs.
Static loading
It is a way 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 the program, the identifier is always referred to as the DLL.
Declarations of imported routines where they are called. It can be used to simplify maintenance, however, it can be used for interfacing with the DLL. (Delphi's Windows unit is a good example.) Other modules can be used.
For more information about external declarations, see External declarations.
Dynamic loading through Windows API calls.
← →
Oleg Gashev (2001-12-15 18:36) [2]-----------------------------------------------------------------
LoadLibrary
The LoadLibrary function maps the specified executable module into the address space of the calling process.
HINSTANCE LoadLibrary (
LPCTSTR lpLibFileName // address of the executable module
);
Parameters
lpLibFileName
Points to a null-terminated string that names the executable module (either a .DLL or .EXE file). It is a rule that it has been assigned the name of the module-definition (.DEF) file.
It is not the case for the directory fails.
The default library extension. DLL is appended. However, it is possible to indicate that the module name has no extension. When the path is specified in the following sequence:
1. The directory from which the application loaded.
2. The current directory.
3. Windows 95: The Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
Windows NT: The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory. The directory of SYSTEM32.
4. Windows NT: The 16-bit Windows system directory. There is no Win32 function, but it is searched. The directory is SYSTEM.
5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
6. The directories that are listed in the PATH environment variable.
This is the first directory that has been used to create the calling process. This file is a directory of the environment variable.
Once the function has been made, it has been determined that the module has been updated. If you’ve previously logged in, you’re not always uploaded. It is a function for the library.
Return Values
If the function succeeds, it is a handle to the module.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.
Remarks
It is a DLL that can be used to get the address of a DLL function. LoadLibrary can also be used to map other executable modules. For example, you can use the FindResource or LoadResource.
Module handles are not global or inheritable. It can be used to
Pages: 1 whole branch
Forum: "Main";
Current archive: 2002.01.08;
Download: [xml.tar.bz2];
Memory: 0.57 MB
Time: 0.022 c