如果用c++重写C项目的部分代码,但遗漏了相同的API,是否存在ABI兼容性问题?
Is there an ABI compatibility issue if part of the code of a C project is rewritten in C++, but with the same API left out?
对于用C编写的共享库项目,如果我用c++重写部分代码,但保留完全相同的api,我会有任何ABI兼容性问题吗?
如果你保持相同的API(函数名和参数类型),你应该很好。
你将需要做的是用这个(copy &(从这里粘贴):
#ifdef __cplusplus
extern "C" {
#endif
// all of your legacy C code here
#ifdef __cplusplus
}
#endif
这可以确保c++编译器不会混淆这些名称,因此C编译器的外部符号仍然可以与导出链接。
相关文章:
- 如何检查第三个 API 是否在 Linux 中为 c/c++ 程序创建了一个新线程?
- 对于堆上的页面对齐内存分配是否有任何优化或不同的 API?
- API 返回智能指针的 std::optional 以明确指定指针可能为 null 是否有意义?
- 同时调用 ASIO 对象的 API 是否安全?
- 使用通常称为 API 实现C++多个客户和生产者解决方案,这是否有效?
- 是否有可以在iOS上运行的API来更改现有视频的每秒帧数?
- 如果我公开常量和非常量 API,我是否破坏了常量正确性?
- 张量流 c++ API 是否支持反向传播的自动微分?
- Microsoft加密 API 是否允许从字节流创建 ECDSA 密钥?
- 如何检查 CNG Windows API 是否返回符合 FIPS 的算法实现
- 在 Android NDK 中使用比 Android 清单中最低 API 更高的 API 是否有效?
- system.speech api 是否支持 c++ 语言进行开发
- 通过Delphi访问Windows API是否会导致性能损失
- wchar_t对Windows API是否有用
- Windows GDI API是否在GetLastError中返回错误代码
- python C API是否与C++完全兼容
- SendNotifyMessage API 是否跨用户会话工作
- COM(C++)对于AddRef和Release中的Thread Saftey来说,互锁API是否足够
- RapidXML API是否可以增加缓冲区
- Windows加密api是否故意运行较慢,并将调试器附加到进程中