Function Modifiers
Go Up to Declaration Syntax Index
This section presents descriptions of the function modifiers available with the C++Builder compiler.
You can use the __declspec(dllexport), and __declspec(dllimport) modifiers to modify functions.
In 32-bit programs the keyword can be applied to class, function, and variable declarations
The __declspec(dllexport) modifier makes the function exportable from Windows. The __declspec(dllimport) modifier makes a function available to a Windows program. The keywords are used in an executable (if you don't use smart callbacks) or in a DLL.
Functions declared with the __fastcall modifier have different names than their non-__fastcall counterparts. The compiler prefixes the __fastcall function name with an @. This prefix applies to both unmangled C function names and to mangled C++ function names.
C++Builder modifiers:
Modifier | Use with | Description |
---|---|---|
const |
Variables |
Prevents changes to object. Note: C++ extends const to include classes and member functions. |
volatile |
Variables |
Prevents register allocation and some optimization. Warns compiler that object might be subject to outside change during evaluation. Note: C++ extends volatile to include classes and member functions. |
__cdecl |
Functions |
Forces C argument-passing convention. Affects linker and link-time names. This is the default. |
__cdecl |
Variables |
Forces global identifier case-sensitivity and leading underscores in C. This is the default. |
__pascal |
Functions |
Forces Pascal argument-passing convention. Affects linker and link-time names. |
__pascal |
Variables |
Forces global identifier case-insensitivity with no leading underscores in C. |
__import |
Functions/classes |
Tells the compiler which functions or classes to import. |
__export |
Functions/classes |
Tells the compiler which functions or classes to export. |
__declspec(dllimport) |
Functions/classes |
Tells the compiler which functions or classes to import. This is the preferred method. |
__declspec(dllexport) |
Functions/classes |
Tells the compiler which functions or classes to export. This is the preferred method. |
__fastcall |
Functions |
Forces register parameter passing convention. Affects the linker and link-time names. |
__stdcall |
Function |
Forces the standard WIN32 argument-passing convention. |