gpt4 book ai didi

rust - Rust 中的 extern fn 和 extern "C"fn 有什么区别?

转载 作者:行者123 更新时间:2023-11-29 07:43:09 30 4
gpt4 key购买 nike

我曾尝试阅读各种 github 问题,试图找出其中的区别,结果却一头雾水。

#[no_mangle]
pub extern fn foo() {
...
}

对比

#[no_mangle]
pub extern "C" fn foo() {
...
}

最佳答案

没有区别因为,as the reference说:

By default external blocks assume that the library they are calling uses the standard C ABI on the specific platform.

extern "C" -- This is the same as extern fn foo(); whatever the default your C compiler supports.

issue创建时总是要求明确声明 extern "C"RFC has been refused .

有一个issuefmt-rfcs关于“我们应该将 extern "C"fn 格式化为那个还是 extern fn?”。

关于rust - Rust 中的 extern fn 和 extern "C"fn 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44664703/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com