伙计们,假设我有一个c ++应用程序/库运行实现说
/* Alloc API */
void* my_alloc(int size) {
return malloc(sizeof(size));
}
Run Code Online (Sandbox Code Playgroud)
这不是"extern c".
我有一个C动态库,我需要调用my_alloc,我可以直接调用该API吗?
Like,
int test_my_alloc (int size) {
int *x;
x = (int*)my_alloc(size);
if (x == NULL) {
return 0;
} else {
return 1;
}
}
Run Code Online (Sandbox Code Playgroud)