ctor
Global, no_std-compatible constructors for all platforms that run before main (like C/C++ __attribute__((constructor)))
1.0.13
178M downloads/mo
#549 most downloaded on crates.io
mmastrac/linktime
What this package is like to depend on
Last release 14 days ago
09 Aug 2026
Release timing varies
gaps range from 8 days to 4 months
Some releases are documented
notes for 20 of 78 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
79 releases · first in 2018
29 releases in the last 12 months
see the full history below
Release timeline
79 releases · Dec 2018 to Aug 2026Releases
latest 60 of 79-
1.0.1309 Aug 2026Release notes
Open source →What's Changed
- Bumped internal proc macro minimum version to pick up consistent 64-bit hash chunks (#508) and the cross-crate section-name fix (#509) (should not result in any downstream visible changes)
- Document
crate_pathand re-exports by @mmastrac in #514
Full Changelog: ctor-1.0.12...ctor-1.0.13
Release notes
Open source →Changed
- Bump
linktime-proc-macrodependency to 0.2.3 (consistent 64-bit hash chunks and cross-crate section-name fix).
Documentation
- Documented the
crate_pathoverride for re-exporting the macro from another crate.
-
1.0.1229 Jul 2026Release notes
Open source →Changed
- Bump
linktime-proc-macrodependency to 0.2.1 (makes link-section names more stable).
- Bump
-
1.0.1126 Jul 2026 -
1.0.1021 Jul 2026Release notes
Open source →Changed
- Faster atomics and #[cold] for
Static::derefinitialization (@yvt PR #501)
- Faster atomics and #[cold] for
-
1.0.916 Jul 2026Release notes
Open source →Fixed
- Ensure the single executing priority ctor is kept alive on Apple platforms (#496).
-
1.0.806 Jul 2026 -
1.0.728 May 2026Release notes
Open source →Changed
- Bump
link-sectiondependency to 0.18.0. - Improve error messages for bad attribute values.
- Bump
-
1.0.617 May 2026Release notes
Open source →Changed
- Bump
link-sectiondependency to 0.17.0. - MSRV bumped to 1.85.0 (if
priorityfeature is enabled), otherwise remains at 1.60.0.- To restore MSRV to 1.60.0, use
ctor = { version = "1.0.6", default-features = false, features = ["proc_macro", "std"] }in your Cargo.toml.
- To restore MSRV to 1.60.0, use
Fixed
#[ctor]requires significantly less macro recursion.
- Bump
-
1.0.511 May 2026 -
1.0.409 May 2026Release notes
Open source →Added
- Support for win7, uwp and other windows targets
- Support for UEFI targets (
.init_arraymatching gnu-efi) - Fallback to
.init_arrayfor unsupported targets (with a warning)
Changed
target_vendor = "pc"is nowtarget_os = "windows". This should be a strictly increasing set of support for windows targets.
-
1.0.307 May 2026Release notes
Open source →Fixed
- A
defaultpriority value is now supported and is the default. This is equivalent to a priority of 500 on most platforms. The previousprioritydefault of 0 was unsafe for C library access on some platforms. - The
earlypriority value is now equivalent to a priority of 101 on most platforms.
- A
-
1.0.206 May 2026Release notes
Open source →Changed
- Bump
link-sectiondependency to 0.15.0. - Use
constrather thanstaticitems for collected constructors on macOS. - Allow various forms of
&'staticfor#[ctor]statics which desugar to&'static Static. - Static items delegate
Displaydirectly as well. - Support for multiple
#[ctor]items in a single#[ctor]block:
#[ctor] static CTOR: &[fn()] = const { // ... } - Bump
-
1.0.104 May 2026Release notes
Open source →Changed
wasm32-unknown-unknownwould run ctor items on each call of an exported function.
-
1.0.003 May 2026Release notes
Open source →Changed
- Stabilized (yay!). Identical to 0.13.1. Thanks to all the contributors who helped along the way! Please file any upgrade issues in https://github.com/mmastrac/linktime/issues.
- For those upgrading from earlier versions, the major changes for you to note
are:
dtorwas split into thedtorcrate. You'll need to add it to your dependencies like so:[dependencies] dtor = "1.0.0" # or later#[ctor(unsafe)]is now required for#[ctor]items. If you are building a binary, you can useRUSTFLAGS="--cfg linktime_no_fail_on_missing_unsafe"(or alternatively, specify this in yourconfig.tomlfile) to bypass the error.- For those re-exporting
ctorfrom their own crates: thector::declarative::ctor!macro should be preferred over#[ctor(crate_path = ...)]. The latter form will continue to work, but the declarative macro is far more stable for most use cases. See https://docs.rs/ctor/latest/ctor/declarative/macro.ctor.html for more details.
-
0.13.102 May 2026Release notes
Open source →Changed
- Crate examples were reorganized.
Fixed
- Documentation fixes (
--cfgflags were incorrect). - Incorrect crate feature in docs.
-
0.13.002 May 2026Release notes
Open source →Changed
#[ctor(priority = naked)]is now#[ctor(naked)].unsafeis now required for#[ctor]items and theno_warn_on_missing_unsafefeature is gone.RUSTFLAGS="--cfg linktime_no_fail_on_missing_unsafe"can bypass the error.
used_linkerfeature moved to--cfg linktime_used_linkerflag.
Added
- Re-added link section option for body of
#[ctor]items (supported for Linux/Android/FreeBSD/Apple).
-
0.12.030 Apr 2026Release notes
Open source →Added
- Support for
#[ctor]onimplitems. To be valid, thefnmust have noselfparameter and must not access any generic parameters from the outer item. - Added
life before maindocumentation to all crates. earlyandlatepriority values are now supported on all platforms.
Removed
- Deprecated
dtorfeature and crate dependency fromctorcrate (use thedtorcrate directly).
Fixed
- AIX uses "standard" priority values from 0 to 999, early and late (mapped to 80000000 to 80000999).
Changed
- If the
priorityfeature is enabled,ctorpriority sorting is now stable and consistent across platforms:early/0/unspecified, then1 <= N < 1000, thenlate. - If a
link_sectionorexport_name_prefixis specified, apriorityvalue must not be specified (now a compiler error). - Migrated to using the
linktime-proc-macrocrate for proc-macro support.
- Support for
-
0.11.128 Apr 2026Release notes
Open source →Changed
- Deprecated
dtormacros in favor of thedtorcrate. - Migrated to using the
linktime-proc-macrocrate for proc-macro support.
Fixed
- Fixed some stray
dtorreferences in ctor docs.
- Deprecated
-
0.11.028 Apr 2026Release notes
Open source →Added
- AIX support for
ctor/dtorcrates.
Changed
- Significant rewrite to ctor/dtor macros and documentation.
- Macro attributes and crate features are auto-documented.
- Rewrote
staticscode inctorto not requirestd.
- AIX support for
-
0.10.122 Apr 2026Release notes
Open source →Added
- Included licenses in all files.
- Bumped proc-macro dependency versions.
Fixed
- Fix MSRV in ctor docs.
- Various hardening fixes under Miri.
- Adding priority to
ctors accidentally enabled the anonymous flag.
Changed
ctorexports alldtormacros fromdtorcrate rather than reimplementing them.
-
0.10.013 Apr 2026Nothing published for this version
-
0.9.109 Apr 2026Nothing published for this version
-
0.9.009 Apr 2026Nothing published for this version
-
0.8.028 Mar 2026Nothing published for this version
-
0.7.027 Mar 2026Nothing published for this version
-
0.6.304 Dec 2025Nothing published for this version
-
0.6.202 Dec 2025Nothing published for this version
-
0.6.103 Nov 2025Nothing published for this version
-
0.6.008 Oct 2025Nothing published for this version
-
0.5.010 Aug 2025Nothing published for this version
-
0.4.327 Jul 2025Nothing published for this version
-
0.4.221 Apr 2025Nothing published for this version
-
0.4.109 Mar 2025Nothing published for this version
-
0.4.026 Feb 2025Nothing published for this version
-
0.3.619 Feb 2025Nothing published for this version
-
0.3.518 Feb 2025Nothing published for this version
-
0.3.415 Feb 2025Nothing published for this version
-
0.3.313 Feb 2025Nothing published for this version
-
0.3.213 Feb 2025Nothing published for this version
-
0.3.112 Feb 2025Nothing published for this version
-
0.3.011 Feb 2025Nothing published for this version
-
0.3.0-beta021 Nov 2024 pre-releaseNothing published for this version
-
0.2.920 Nov 2024Nothing published for this version
-
0.2.816 Apr 2024Nothing published for this version
-
0.2.726 Feb 2024Nothing published for this version
-
0.2.612 Dec 2023Nothing published for this version
-
0.2.526 Sep 2023Nothing published for this version
-
0.2.413 Jul 2023Nothing published for this version
-
0.2.330 Jun 2023Nothing published for this version
-
0.2.231 May 2023Nothing published for this version
-
0.2.130 May 2023Nothing published for this version
-
0.2.026 Mar 2023Nothing published for this version
-
0.1.2619 Oct 2022Nothing published for this version
-
0.1.2518 Oct 2022Nothing published for this version
-
0.1.2418 Oct 2022Nothing published for this version
-
0.1.2328 Jul 2022Nothing published for this version
-
0.1.2218 Mar 2022Nothing published for this version
-
0.1.2131 Aug 2021Nothing published for this version
-
0.1.2023 Mar 2021Nothing published for this version
-
0.1.1902 Feb 2021Nothing published for this version