经常可以遇到这样的SDK,需要传递一个回调函数。例如:
通过回调的方式将数据返回给调用者。 在回调结束之后 void* a
里存的数据就会被释放。
test.h
#ifndef __TEST_H__
#define __TEST_H__
#ifdef __cplusplus
extern "C"{
#endif
#define API __attribute__((visibility("default")))
typedef struct info{
void* a;
int size;
}tInfo;
typedef int(*cb) (tInfo* n);
API int setcallback(cb s);
API void call()