RAD Studio
ContentsIndex
PreviousUpNext
Function Modifiers

This section presents descriptions of the function modifiers available with the CodeGear C++ compiler. 

You can use the __declspec(dllexport), and __declspec(dllimport)and __saveregs 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.  

CodeGear C++ modifiers  

Modifier 
Use with 
Description 
const1  
Variables  
Prevents changes to object.  
volatile1  
Variables  
Prevents register allocation and some optimization. Warns compiler that object might be subject to outside change during evaluation.  
__cdecl2  
Functions  
Forces C argument-passing convention. Affects linker and link-time names.  
__cdecl2  
Variables  
Forces global identifier case-sensitivity and leading underscores in C.  
__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.  

  1. C++ extends const and volatile to include classes and member functions. 

  2. This is the default.
 

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