{"id":16714214,"url":"https://github.com/flier/contructor-derive","last_synced_at":"2025-03-15T07:11:51.191Z","repository":{"id":62438909,"uuid":"159486151","full_name":"flier/contructor-derive","owner":"flier","description":"Registers a function to be called before/after main (if an executable) or when loaded/unloaded (if a dynamic library).","archived":false,"fork":false,"pushed_at":"2018-11-28T10:57:07.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-21T22:09:43.062Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flier.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-28T10:43:48.000Z","updated_at":"2019-05-19T18:26:56.000Z","dependencies_parsed_at":"2022-11-01T22:00:33.720Z","dependency_job_id":null,"html_url":"https://github.com/flier/contructor-derive","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fcontructor-derive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fcontructor-derive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fcontructor-derive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flier%2Fcontructor-derive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flier","download_url":"https://codeload.github.com/flier/contructor-derive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243695589,"owners_count":20332629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T20:49:53.147Z","updated_at":"2025-03-15T07:11:51.170Z","avatar_url":"https://github.com/flier.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"contructor_derive [![Build Status](https://travis-ci.org/flier/contructor-derive.svg?branch=master)](https://travis-ci.org/flier/contructor-derive) [![Latest Version](https://img.shields.io/crates/v/contructor_derive.svg)](https://crates.io/crates/contructor_derive) [![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/contructor-derive)\n====\n\nRegisters a function to be called before/after main (if an executable)\nor when loaded/unloaded (if a dynamic library).\n\n**Notes**\n\nUse this library is unsafe unless you want to interop directly with a FFI library.\n\nPlease consider to use the `lazy-static` crate instead of it.\n\n## Usage\n\nAdd the following dependency to your Cargo manifest...\n\n```toml\n[dependencies]\ncontructor_derive = \"0.1.0\"\n```\n\n## Example\n\n```rust\n#[macro_use]\nextern crate contructor_derive;\n\npub static mut RAN: bool = false;\n\n#[constructor]\nextern \"C\" fn set_ran() {\n    unsafe { RAN = true }\n}\n\n#[destructor]\nextern \"C\" fn reset_ran() {\n    unsafe { RAN = false }\n}\n\nfn main() {\n    assert!(unsafe { RAN });\n}\n```\n\n## License\n\nLicensed under either of\n\n * Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Fcontructor-derive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflier%2Fcontructor-derive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflier%2Fcontructor-derive/lists"}