Attribute Macro export

Source
#[export]
Expand description

Export a function so that C code can call it via a header file.

Functions exported using this macro can be called from C code using the declaration in the appropriate header file. It should only be used in cases where C calls the function through a header file; cases where C calls into Rust via a function pointer in a vtable (such as file_operations) should not use this macro.

This macro has the following effect:

  • Disables name mangling for this function.
  • Verifies at compile-time that the function signature matches the declaration in the header file.

You must declare the signature of the Rust function in a header file that is included by rust/bindings/bindings_helper.h.

This macro is not the same as the C macros EXPORT_SYMBOL_*. All Rust symbols are currently automatically exported with EXPORT_SYMBOL_GPL.