I try to use libmagic in my c code.
I compile the following code like this (gcc mime.c -shared -o mime.so
). Unfortunately it throws me this error when using it: OSError: mime.so: undefined symbol: magic_load
mime.c
#include <stdio.h>
#include <magic.h>
void get(char* argv[]) {
magic_t myt = magic_open(MAGIC_CONTINUE|MAGIC_ERROR/*|MAGIC_DEBUG*/|MAGIC_MIME);
magic_load(myt,NULL);
char value = magic_file(myt, argv[1]);
magic_close(myt);
return value;
}
How can I fix this?