Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glandium/global_allocator_linkage-rs
https://github.com/glandium/global_allocator_linkage-rs
Last synced: 11 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/glandium/global_allocator_linkage-rs
- Owner: glandium
- Created: 2019-08-08T00:21:52.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-08T00:29:44.000Z (over 5 years ago)
- Last Synced: 2024-10-28T11:26:34.622Z (about 2 months ago)
- Language: Rust
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Test case showing how two staticlib crates can define a global_allocator each
and end up using the other's when everything is linked together, with neither
the rust compiler nor the linker raising an eyebrow.Run `make` in the top-level directory.
Some details:
-------------The foo crate is a staticlib that exports a single function, `foo`, that leaks
a `Box` allocated with its global_allocator. Its global_allocator wraps
`std::alloc::System` and prints "foo" to stdout on allocation.The bar crate is exactly the same code, except it exports a single function `bar`,
and its global_allocator prints "bar".The `foobar` executable is linked with libfoo and libbar in that order, and its
`main` function calls the exported function from each library.The `barfoo` executable is linked with libbar and libfoo in that order, and its
`main` function calls the exported function from each library.With the first executable, the global_allocator from libfoo is used for both
libraries, and with the second, the global_allocator from libbar is used.