RAD Studio
ContentsIndex
PreviousUpNext
Creating packages and DLLs
Name 
Description 
One of the strengths of DLLs is that a DLL created with one development tool can often be used by application written using a different development tool. When your DLL contains VCL components (such as forms) that are to be used by the calling application, you need to provide exported interface routines that use standard calling conventions, avoid C++ name mangling, and do not require the calling application to support the VCL libraries in order to work. To create VCL components that can be exported, use runtime packages.
For example, suppose you want to create a DLL to display the... more 
Dynamic link libraries (DLLs) are modules of compiled code that work in conjunction with an executable to provide functionality to an application. You can create DLLs in cross-platform programs. However, on Linux, DLLs (and packages) recompile as shared objects.
DLLs and libraries should handle all exceptions to prevent the display of errors and warnings through Windows dialogs.
The following compiler directives can be placed in library project files:
Compiler directives for libraries  
You can set the linker options for your DLL on the Linker page of the Project Options dialog box. The default check box on this page also creates an import library for your DLL. If compiling from the command line, invoke the linker, ilink32.exe, with the -Tpd switch. For example:  
For most applications, packages provide greater flexibility and are easier to create than DLLs. However, there are several situations where DLLs would be better suited to your projects than packages:
  • Your code module will be called from non-Delphi applications.
  • You are extending the functionality of a Web server.
  • You are creating a code module to be used by third-party developers.
  • Your project is an OLE container.
You cannot pass Delphi runtime type information (RTTI) across DLLs or from a DLL to an executable. If you pass an object from one DLL to another DLL or an executable, you will not... more 
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:... more 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!