Skip to main content

section

Attribute Macro section 

Source
#[section]
Expand description

Define a link section.

The definition site generates two items: a static section struct that is used to access the section, and a macro that is used to place items into the section. The macro is used by the in_section procedural macro.

§Attributes

  • no_macro: Does not generate the submission macro at the definition site. This will require any associated in_section invocations to use the raw name of the section.
  • aux = <name>: Specifies that this section is an auxiliary section, and that the section is named <name>+<aux>.

§Example

use link_section::{in_section, section};

#[section]
pub static DATA_SECTION: link_section::Section;

#[in_section(DATA_SECTION)]
pub fn data_function() {
    println!("data_function");
}