이곳에 있는 자료를 보면서 동적 라이브러리를 만들어보려고 하는데
자꾸 에러가 나오네요.
// 라이브러리 파일 (libenc.so)
void Initial (int i, int j) {
.....
}
// 메인 (enc.c)
void main (){
int i, j;
void (*Init)();
en = dlopen("/usr/local/lib/libenc.so", RTLD_LAZY);
Init = dlsym(en, "Initial"); <==== (1)
(*Init)(i, j); <==== (2)
.......
}
이런식으로 작성을 했는데
gcc -o enc enc.c -ldl 로 컴파일을 하면
(1)에선 cannot convert 'void *' to 'void (*)()' in assignment
(2)에선 too many arguments to function