RAD Studio
ContentsIndex
PreviousUpNext
__declspec(naked)

Category 

Modifiers, Keyword extensions, Storage class specifiers 

Syntax  

__declspec( naked ) declarator

Use of the naked argument suppresses the prolog/epilog code. Be aware when using __declspec(naked) that it does not set up a normal stack frame. A function with __declspec(naked) will not preserve the register values that are normally preserved. It is the programmer's responsibility to conform to whatever conventions the caller of the function expects. 

You can use this feature to write your own prolog/epilog code using inline assembler code. Naked functions are particularly useful in writing virtual device drivers. 

The naked attribute is relevant only to the definition of a function and is not a type modifier. 

Example 

This code defines a function with the naked attribute:

// Example of the naked attribute
__declspec( naked ) int func( formal_parameters )
{
// Function body
}
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!