Casting when using dlsym()
I'm using dlsym() in C and I have a question whether the return value of dlsym() should be explicitly cast or if it is implicitly cast correctly. Here is the function: double (*(compile)(void))(double x, double y) { if (system("scan-build clang -fPIC -shared -g -Wall -Werror -pedantic " "-std=c11 -O0 -lm foo.c -o foo.so") != 0) { exit(EXIT_FAILURE); } void *handle; handle = dlopen("./foo.so", RTLD_LAZY); if (!handle) { printf("Failed to load foo.so: %s\n", dlerror()); exit(EXIT_FAILURE); } foo f; f = (foo)dlsym(handle, "foo"); if (!f) { printf("Failed to find symbol foo in foo.so: %s\n",