The data stored in a PE File using the .data directive can be accessed through a static variable, either global or a member of a type, declared at a particular position of the data:
FieldDecl ::= |
---|
FieldAttr* Type Id at DataLabel |
The data is then accessed by a program as it would access any other static variable, using instructions such as ldsfld
, ldsflda
, and so on (see Partition III). The ability to access data from within the PE File can be subject to platform-specific rules, typically related to section access permissions within the PE File format itself.
[Example: The following accesses the data declared in the example of §II.16.3.1. First a static variable needs to be declared for the data, e.g., a global static variable:
.field public static int32 myInt at theInt
Then the static variable can be used to load the data:
ldsfld int32 myInt
// data on stack
end example]