# Crate Features
| `no_warn_on_missing_unsafe` | Do not warn when a ctor is missing the `unsafe` keyword. |
| `priority_enabled` | Enable support for the priority parameter. |
| `proc_macro` | Enable support for the proc-macro `#[ctor]` attribute. The declarative form (`ctor!(...)`) is always available. It is recommended that crates re-exporting the `ctor` macro disable this feature and only use the declarative form. |
| `std` | Enable support for the standard library. |
| `used_linker` | Applies `used(linker)` to all `ctor`-generated functions. Requires nightly and `feature(used_with_arg)`. |
# Macro Attributes
<table><tr><th>Attribute</th><th>Description</th></tr>
<tr><td><code>anonymous</code></td><td>
Do not give the constructor a name in the generated code (allows for
multiple constructors with the same name). Equivalent to wrapping the
constructor in an anonymous const (i.e.: `const _ = { ... };`).
</td></tr>
<tr><td><code>crate_path = $path : pat</code></td><td>
The path to the `ctor` crate containing the support macros. If you
re-export `ctor` items as part of your crate, you can use this to
redirect the macro’s output to the correct crate.
Using the declarative [`ctor!`][c] form is
preferred over this parameter.
[c]: crate::declarative::ctor!
</td></tr>
<tr><td><code>export_name_prefix = $export_name_prefix_str : literal</code></td><td>
Specify a custom export name prefix for the constructor function.
If specified, an export with the given prefix will be generated in the form:
`<prefix><priority>_<unique_id>`
</td></tr>
<tr><td><code>link_section = $section : literal</code></td><td>
Place the constructor function pointer in a custom link section. By
default, this uses the appropriate platform-specific link section.
</td></tr>
<tr><td><code>unsafe</code></td><td>
Marks a ctor as unsafe. Recommended.
</td></tr>
<tr><td><code>priority = $priority_value : tt</code></td><td>
The priority of the constructor. Higher-`N`-priority constructors are
run last. `N` must be between 0 and 999 inclusive for ordering
guarantees (`N` >= 1000 ordering is platform-defined).
Priority is specified as an isize, string literal, or the identifiers
`early`, `late`, or `naked`. The integer value will be clamped to a
platform-defined range (typically 0-65535), while the string value will
unprocessed. `naked` indicates that the constructor should not use a
priority value, and should use the low-level platform-specific
unprioritized mechanism.
Priority is applied as follows:
- `early` is the default, and is run first (constructors annotated with
`early` and those with no priority attribute are run in the same
phase).
- `N` is run in increasing order, from 0 <= N <= 999.
- `late` is run last, and will be positioned to run after most
constructors, even outside the range 0 <= N <= 999.
- `main` is run, for binary targets.
Ordering outside of `0 <= N <= 999` is platform-defined with respect to
the list above, however platforms will order constructors within a given
length range in ascending order (ie: 10000 will run before 20000).
</td></tr>
<tr><td><code>used(linker)</code></td><td>
Mark generated functions for this `ctor` as `used(linker)`. Requires nightly and `feature(used_with_arg)`.
</td></tr>
</table>
# Defaults
## `export_name_prefix`
```rust
# #[cfg(false)] {
#[cfg(target_os = "aix")]
# const _: () = { let
export_name_prefix = "__sinit"
# ; };
// default
export_name_prefix = ()
# }
```
## `link_section`
```rust
# #[cfg(false)] {
#[cfg(target_vendor = "apple")]
# const _: () = { let
link_section = "__DATA,__mod_init_func,mod_init_funcs"
# ; };
#[cfg(any(target_os = "linux", target_os = "android", target_os = "freebsd",
target_os = "netbsd", target_os = "openbsd", target_os = "dragonfly",
target_os = "illumos", target_os = "haiku", target_os = "vxworks", target_os =
"nto", target_family = "wasm"))]
# const _: () = { let
link_section = ".init_array"
# ; };
#[cfg(target_os = "none")]
# const _: () = { let
link_section = ".init_array"
# ; };
#[cfg(target_arch = "xtensa")]
# const _: () = { let
link_section = ".ctors"
# ; };
#[cfg(all(target_vendor = "pc", any(target_env = "gnu", target_env = "msvc")))]
# const _: () = { let
link_section = ".CRT$XCU"
# ; };
#[cfg(all(target_vendor = "pc", not(any(target_env = "gnu", target_env = "msvc"))))]
# const _: () = { let
link_section = ".ctors"
# ; };
#[cfg(all(target_os = "aix"))]
# const _: () = { let
link_section = ()
# ; };
// default
link_section = (compile_error! ("Unsupported target for #[ctor]"))
# }
```
## `priority`
```rust
# #[cfg(false)] {
#[cfg(feature = "priority")]
# const _: () = { let
priority = early
# ; };
// default
priority = naked
# }
```