Windows中的storage-class Attribute

1 先看C语言中的可以使用的__declspec(...)的参数。
下面是拷贝的微软msdn文档中的解释:

Extended attribute syntax simplifies and standardizes the Microsoft-specific extensions to 
the C language. The storage-class attributes that use extended attribute syntax include thread,
naked, dllimport, and dllexport. The extended attribute syntax for specifying storage-class information uses the __declspec keyword,
which specifies that an instance of a given type is to be stored with
a Microsoft-specific storage-class attribute (thread, naked, dllimport, or dllexport).
Examples of other storage-class modifiers include the static and extern keywords.
However, these keywords are part of the ANSI C standard and as such are not covered by
extended attribute syntax. Syntax storage-class-specifier: __declspec ( extended-decl-modifier-seq ) /* Microsoft Specific */ extended-decl-modifier-seq: extended-decl-modifier opt extended-decl-modifier-seq extended-decl-modifier extended-decl-modifier: thread naked dllimport dllexport White space separates the declaration modifiers. Note that extended-decl-modifier-seq can be empty;
in this case, __declspec has no effect. The thread, naked, dllimport, and dllexport storage-class attributes are a property
only of the declaration of the data or function to which they are applied;
they do not redefine the type attributes of the function itself.
The thread attribute affects data only. The naked attribute affects functions only.
The dllimport and dllexport attributes affect functions and data. END Microsoft Specific

 2 C中的storage-class attribute要比C++少很多。
只有微软提供的编译器才识别这些东西,比如naked在windows下的gcc编译器是被忽略的,也就是不会识别。(我试验过的)

posted @ 2011-12-05 13:10  Jack204  阅读(279)  评论(0编辑  收藏  举报