On Wed, Oct 23, 2024 at 12:48:33PM +0200, Paolo Bonzini wrote:
> Date: Wed, 23 Oct 2024 12:48:33 +0200
> From: Paolo Bonzini <pbonz...@redhat.com>
> Subject: Re: [PATCH v2 05/13] rust: remove uses of #[no_mangle]
> 
> On 10/21/24 18:35, Paolo Bonzini wrote:
> > @@ -566,7 +563,6 @@ pub fn update(&self) {
> >   /// # Safety
> >   ///
> >   /// We expect the FFI user of this function to pass a valid pointer for 
> > `chr`.
> > -#[no_mangle]
> >   pub unsafe extern "C" fn pl011_create(
> >       addr: u64,
> >       irq: qemu_irq,
> This _needs_ to be no_mangle actually, because it is called from C.
>  

I'm a bit uncertain whether the "pub" keyword here should be removed.

I understand that pub and private are based on modules and do not apply
to FFI, but I haven't found any related documentation to confirm this.

However, technically, removing the pub here does not seem to cause any
issues during compilation and runtime.

Additionally, the pub keywords in the other functions involved in this
patch (except for the one in device_class_init) can also be removed, as
they are either only used as C callbacks or are indeed only used within
the current crate after macro expansion.

-Zhao


Reply via email to