【发布时间】:2009-06-05 14:47:50
【问题描述】:
我写了一个库并想测试它。我编写了以下程序,但我从 eclipse 中收到一条错误消息。
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
int main(int argc, char **argv) {
void *handle;
double (*desk)(char*);
char *error;
handle = dlopen ("/lib/CEDD_LIB.so.6", RTLD_LAZY);
if (!handle) {
fputs (dlerror(), stderr);
exit(1);
}
desk= dlsym(handle, "Apply"); // ERROR: cannot convert from 'void *' to 'double*(*)(char*)' for argument 1
if ((error = dlerror()) != NULL) {
fputs(error, stderr);
exit(1);
}
dlclose(handle);
}
怎么了?
问候。
【问题讨论】:
-
如果这是 C++,为什么它看起来这么像 C?