6 #endif /* HAVE_CONFIG_H */
10 #include <atalk/util.h>
14 #include <mach-o/dyld.h>
16 void *mod_open(const char *path)
18 NSObjectFileImage file;
20 if (NSCreateObjectFileImageFromFile(path, &file) !=
21 NSObjectFileImageSuccess)
23 return NSLinkModule(file, path, TRUE);
26 void *mod_symbol(void *module, const char *name)
31 if ((underscore = (char *) malloc(strlen(name) + 2)) == NULL)
33 strcpy(underscore, "_");
34 strcat(underscore, name);
35 symbol = NSLookupAndBindSymbol(underscore);
38 return NSAddressOfSymbol(symbol);
41 void mod_close(void *module)
43 NSUnLinkModule(module, FALSE);
45 #endif /* MACOSX_SERVER */
47 #else /* HAVE_DLFCN_H */
51 #ifdef DLSYM_PREPEND_UNDERSCORE
52 void *mod_symbol(void *module, const char *name)
60 if ((underscore = (char *) malloc(strlen(name) + 2)) == NULL)
63 strcpy(underscore, "_");
64 strcat(underscore, name);
65 symbol = dlsym(module, underscore);
70 #endif /* DLSYM_PREPEND_UNDERSCORE */
71 #endif /* HAVE_DLFCN_H */