RAD Studio
ContentsIndex
PreviousUpNext
Using DLLs in RAD Studio (C++)

A Windows DLL can be used in a RAD Studio application just as it would be in any C++ application. 

To statically load a DLL when your C++ application is loaded, link the import library file for that DLL into your C++ application at link time. To add an import library to a C++ application, choose Project->Add to Project and select the .lib file you want to add to the libraries to be linked. 

The exported functions of that DLL then become available for use by your application. Prototype the DLL functions your application uses with the __declspec (dllimport) modifier:  

__declspec(dllimport) return_type imported_function_name(parameters);

To dynamically load a DLL during the run of a C++ application, include the import library, just as you would for static loading, and set the Delay load a DLL option for ilink32. You can also use the Windows API function LoadLibrary() to load the DLL, then use the API function GetProcAddress() to obtain pointers to the individual functions you want to use.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!