我必须从python调用c函数。以下是我遵循的步骤:
为了从python中的abc.c调用函数,我编写了以下代码:
from ctypes import cdll
hello_lib = cdll.LoadLibrary(path to abc.so.1.0)
hello = hello_lib.xyz
When i am calling this function, it is giving me the error :
undefined symbol: close_file
c函数是这样的:
int xyz(unsigned char*ptrJPG,int length,char*主路径,int Type,int Play,char*结果,int resultslength, 字符*错误,字符*名称){ ............................ ............................ …………………..}
文件abc.c有很多功能
在c文件的基础上,我导入了以下文件:
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "../headers/Functions.h"
#include "../headers/util.h"
#include "../headers/ocr.h"
#include "../headers/postprocessing.h"
#include "../headers/memmgr.h"
#include "../headers/logging.h"
#include "../headers/BarCode.h"
我知道由于这些文件存在依赖性问题,我认为问题在于将.o文件转换为.so文件。有谁能告诉我如何解决这个问题,以及需要执行什么命令来创建.so文件。在
目前没有回答
相关问题 更多 >
编程相关推荐