RAD Studio |  |

__declspec
See Also
Collapse All

Category

Modifiers, Keyword extensions, Storage class specifiers

Syntax

Copy Code

    __declspec(<decl-modifier>)

Description

For a list of __declspec keyword arguments used for the VCL framework, see VCL class declarations.

Use the __declspec keyword to indicate the storage class attributes for a variable or function.

The __declspec keyword extends the attribute syntax for storage class modifiers so that their placement in a declarative statement is more flexible. The __declspec keyword and its argument can appear anywhere in the declarator list, as opposed to the old-style modifiers which could only appear immediately preceding the identifier to be modified.

Copy Code

    __export void f(void);                      // illegal
    void __export f(void)                       // correct
    void __declspec(dllexport) f(void);         // correct
    __declspec(dllexport)void f(void);          // correct
    class __declspec(dllexport) ClassName { }   // correct

In addition to the arguments listed above, the supported decl-modifier arguments are:

- dllexport
- dllimport
- naked
- noreturn
- nothrow
- novtable
- property
- selectany
- thread
- uuid

These arguments are equivalent to the following storage class attribute keywords.

Argument | Comparable keyword
dllexport | __export
dllimport | __import
thread | __thread

See Also

_export

import

__declspec(dllexport)

__declspec(dllimport)

__declspec(naked)

__declspec(noreturn)

__declspec(nothrow)

__declspec(novtablet)

__declspec(property)

__declspec(selectany)

__declspec(thread)

__declspec(uuid)

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