-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
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:
pub extern {
static curscr: *WINDOW;
....
unsafe fn addch (_:chtype) -> c_int;
...
}
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.
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.