我有现有的C代码及其标头,我需要从Rust调用C代码。我尝试了很多方法并参考了文档,但是我不知道如何将其应用于代码。我面临着将C函数转换为Rust的困难。请帮我举一些例子,以便我容易理解。
我尝试使用Rust书中提供的示例以及其他网站示例,但是没有资源对此提供更多详细信息。
C_code.h
void ifx_vec_init_r(ifx_Vector_R_t* vector,ifx_Float_t* d,uint32_t length);
void ifx_vec_init_c(ifx_Vector_C_t* vector,ifx_Complex_t* d,uint32_t length);
void ifx_vec_rawview_r(ifx_Vector_R_t* vector,uint32_t length,uint32_t stride);
void ifx_vec_sub_r(const ifx_Vector_R_t* v1,const ifx_Vector_R_t* v2,ifx_Vector_R_t* result);
我想在Rust中调用上述所有函数,但是我无法理解如何启动或更改。包装此C代码时需要注意什么?有哪些可用的方法?