You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From reading rust.md and tutorial-ffi.md, I did not see how to expose a global variable from a library. (E.g. I've been poking at hooking into pdcurses / ncurses, and ncurses in some platforms uses global variables to expose curscr/newscr/stdscr).
As far as I can tell, one can do this via the syntax you would expect, namely:
But we should be more up front about whether this is the official syntax, or whether I am just getting lucky here in the short-term and that one should not expect linkage to non-functions to work in the long-term.
The text was updated successfully, but these errors were encountered:
When I was adding static mut I also "got lucky" in doing that exact syntax. At least for static mut, that's the intended syntax for interfacing with an external C library.
If this isn't documented though, I do agree that it should be documented. I'll see if I can't write up a section at least on static mut and maybe static in general inside the extern block.
Factor out `clippy_utils` crate
As discussed in rust-lang/rust-clippy#6746, this PR factors out `clippy_lints::utils` as its own crate, `clippy_utils` .
This change will allow `clippy_utils` to be used in lints outside of Clippy.
There is no plan to publish this crate on `crates.io` (see rust-lang/rust-clippy#6746 (comment)). Dependent crates should obtain it from GitHub.
changelog: Factor out `clippy_utils` so it can be used by external tools (not published)
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Feb 25, 2021
…-lints, r=flip1995
Move conf.rs back into clippy_lints
This is an alternative solution to rust-lang#6785 to fix the CI break caused by rust-lang#6756.
changelog: none
From reading rust.md and tutorial-ffi.md, I did not see how to expose a global variable from a library. (E.g. I've been poking at hooking into pdcurses / ncurses, and ncurses in some platforms uses global variables to expose curscr/newscr/stdscr).
As far as I can tell, one can do this via the syntax you would expect, namely:
But we should be more up front about whether this is the official syntax, or whether I am just getting lucky here in the short-term and that one should not expect linkage to non-functions to work in the long-term.
The text was updated successfully, but these errors were encountered: