RAD Studio
|
You use module definition files with ILINK32. A module definition file is an ASCII text file that provides information to ILINK32 about the contents and system requirements of a Windows application. Use IMPDEF to create a module definition file.
The module definition file names the .EXE or .DLL, identifies the application type, lists imported and exported functions, describes the code section and data segment attributes, lets you specify attributes for additional code sections and data segments, specifies the size of the stack, and provides for the inclusion of a stub program.
Defines the default attributes of code sections. Code sections can have any name, but must belong to section classes whose name ends in CODE (such as CODE or MYCODE).
CODE [PRELOAD | LOADONCALL] [EXECUTEONLY | EXECUTEREAD]
Defines attributes of data segments:
DATA [NONE | SINGLE | MULTIPLE] [READONLY | READWRITE] [PRELOAD | LOADONCALL] [SHARED | NONSHARED]
Inserts text into the application module and is typically used to embed author, date, or copyright information:
DESCRIPTION 'Text'
Text is an ASCII string delimited with single quotes.
Defines the default executable file (.EXE) header type for applications. You can leave this section in for 32-bit applications for backward compatibility, but if you need to change the EXETYPE, see the NAME statement.
EXETYPE [WINDOWAPI] | [WINDOWCOMPAT]
Defines the names and attributes of functions to be exported. The EXPORTS keyword marks the beginning of the definitions. It can be followed by any number of export definitions, each on a separate line.
EXPORTS <EsportName> [<Ordinal>] [RESIDENTNAME] [<Parameter>]
Defines the number of bytes the application needs for its local heap. An application uses the local heap whenever it allocates local memory.
HEAPSIZE <Reserve>[, <Commit>]
Reserved memory refers to the maximum amount of memory that can be allocated either in physical memory or in the paging file. In other words, reserved memory specifies the maximum possible heap size. The operating system guarantees that the specified amount of memory will be reserved and, if necessary, allocated.
The meaning of committed memory varies among operating systems. In Windows NT, commited memory refers to the amount of physical memory allocated for the heap at application load/initialization time. Committed memory causes space to be allocated either in physical memory or in the paging file. A higher commit value saves time when the application needs more heap space, but increases memory requirements and possible startup time.
You can override any heap reserve or commit size specified in the .DEF file with the ‑H or ‑Hc ILINK32 command-line options. ‑H lets you specify a heap reserve size less than the 64K minimum allowed in the .DEF file.
Defines the names and attributes of functions to be imported from DLLs. The IMPORTS keyword marks the beginning of the definitions followed by any number of import definitions, each on a separate line.
IMPORTS [<InternalName>=]<ModuleName>.<Entry>
Instead of listing imported DLL functions in the IMPORTS statement, you can either specify an import library for the DLL in the ILINK32 command line, or include the import library for the DLL in the project manager in the IDE.
You must use either __declspec(dllimport) or __import to import any function, class, or data you want imported. The prefered method is to use __declspec(dllimport)
The IMPORTS keyword can also be applied to (global) variables, as follows:
[ in the dll source file (dll.cpp) ] int sample = 100; [ dll.def ] EXPORTS _sample [ in application source file (app.cpp) ] int _declspec(dllimport) sample; [ app.def ] IMPORTS dll._sample
Defines the name of a DLL module. A module definition file can contain either a LIBRARY statement to indicate a .DLL or a NAME statement to indicate a .EXE. A library's module name must match the name of the executable file. For example, the library MYLIB.DLL has the module name MYLIB.
LIBRARY <LibrarName> [INITGLOBAL | INITINSTANCE]
Is the name of the application's executable module. The module name identifies the module when exporting functions. NAME must appear before EXETYPE. If NAME and EXETYPE don't specify the same target type, the linker uses the type listed with NAME.
NAME <ModuleName> [WINDOWSAPI] | [WINDOWCOMPAT]
Lets you set attributes for one or more section in the image file. you can use this You can use this statement to override the default attributes for each different type of section.
SECTIONS<section_name> [CLASS '<ClassName>'] <attributes>
Defines the attributes of additional code and data sections. The SEGMENTS keyword is supported as a synonym for SECTIONS. The syntax is:
SEGMENTS <SegmentName> [CLASS '<ClassName>'] [<MinAlloc>] [SHARED | NONSHARED] [PRELOAD | LOADONCALL]
Defines the number of bytes the application needs for its local stack. An application uses the local stack whenever it makes function calls.
STACKSIZE <Reserve>[, <Commit>]
Reserved memory refers to the maximum amount of memory that can be allocated either in physical memory or in the paging file. In other words, reserved memory specifies the maximum possible stack size.
The operating system guarantees that the specified amount of memory will be reserved and, if necessary, allocated.
The meaning of committed memory varies among operating systems. In Windows NT, commited memory refers to the amount of physical memory allocated for the stack at application load/initialization time. Committed memory causes space to be allocated either in physical memory or in the paging file. A higher commit value saves time when the application needs more stack space, but increases memory requirements and possible startup time.
You can override any stack reserve or commit size specified in the .DEF file with the ILINK32 ‑S or ‑Sc command-line options. ‑S lets you specify a stack reserve size less than the 64K minimum allowed in the .DEF file.
Appends a DOS executable file specified by FileName to the beginning of the module. The executable stub displays a warning message and terminates if the user attempts to run the executable stub in the wrong environment (running a Windows application under DOS, for example).
STUB '<FileName>'
C++Builder adds a built-in stub to the beginning of a Windows application unless a different stub is specified with the STUB statement. You should not use the STUB statement to include WINSTUB.EXE because the linker does this automatically.
Lets you specify the Windows subsystem and subsystem version number for the application being linked.
SUBSYSTEM [<subsystem>,]<subsystemID>
You can override any SUBSYSTEM statement in a .DEF file using the ‑a and ‑V ILINK32 command-line options.
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|