首页 > 编程语言 > 详细

c语言调用c++库的头文件

时间:2020-04-29 10:12:10      阅读:159      评论:0      收藏:0      [点我收藏+]
#ifndef OBJECT_DETECT_H
#define OBJECT_DETECT_H 
#include <stdbool.h>
/*************************************************
功能: 对象检测(检测视频中的台标、人物等)
参数说明:
src             :输入图像数据(YUV420P)
srcStride       :输入数据的长度
image_width     :输入图像宽度
image_height    :输入图像高度
model_path      :对象检测模型的路径(.pb)
pbtxt_path      :模型对应的描述文件(.pbtxt 需通过opencv-4.2.0/sample/dnn/tf_text_graph_ssd.py进行生成)
object_name_path:对象id到名称的映射
min_match_rate  :最小匹配率
show            :是否显示检测到的结果
**************************************************/
#ifdef __cplusplus
extern "C"{
#endif
bool object_detect(unsigned char* src[8], int srcStride[8],int image_width,int image_height,char* model_path,char* pbtxt_path,char *object_name_path,float min_match_rate,bool show);
#ifdef __cplusplus
}
#endif
#endif

以上是库文件对应的头文件,头文件必须有extern c 才能被C调用

[root@node0 lib_object_detect]# nm object_detect.so |grep object_detect
000000000001249e t _GLOBAL__sub_I_object_detect.cpp
0000000000010203 T object_detect
000000000021de30 b _ZGVZ13object_detectE8kWinName
0000000000017e08 r _ZZ13object_detectE8__func__
000000000021de48 b _ZZ13object_detectE8kWinName
[root@node0 lib_object_detect]# ls
Makefile  object_detect.cpp  object_detect.h  object_detect.so  test.cpp

nm的符号中必须有object_detect才行,切object_detect前不能有其他字符

c语言调用c++库的头文件

原文:https://www.cnblogs.com/lvyunxiang/p/12800208.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!