enarx-archive/cipherpipe

Mark all C functions as extern "C"

Closed this issue · 2 comments

I missed this in my first pass. All the C functions that we override or export need to be marked as extern "C". For example:

#[no_mangle]
pub fn accept(fd: c_int, addr: *mut libc::sockaddr, addr_len: *mut libc::socklen_t) -> c_int {
    accept4(fd, addr, addr_len, 0)
}

Needs to become:

#[no_mangle]
pub extern "C" fn accept(fd: c_int, addr: *mut libc::sockaddr, addr_len: *mut libc::socklen_t) -> c_int {
    accept4(fd, addr, addr_len, 0)
}

Do we need to reorganize the function declaration since we have a format width limitation?

That would be nice, yes. Ideally rustfmt gets run in CI, but there's no CI on this project yet.