Skip to content

Add Box<T> to the supported types, where T: Sized #474

@eliaslevy

Description

@eliaslevy

As of Rust 1.41.0:

Box<T>, where T: Sized is now ABI compatible with the C language's pointer (T*)
types. So if you have an extern "C" Rust function, called from C, your Rust function can
now use Box<T>, for some specific T, while using T* in C for the corresponding function.

(from Announcing Rust 1.41.0)

So that

#[no_mangle]
pub extern fn test() -> Box<i32> { Box::new(1i32) }

should generate

int32_t * test();

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions