1#include <unistd.h> 2#include <dlfcn.h> 3 4int waiting(volatile int *a) 5{ 6 return (*a); 7} 8 9/* 10 * Value taken from pcre.h 11 */ 12#define PCRE_CONFIG_UTF8 0 13 14int main(void) 15{ 16 volatile int a = 0; 17 18 while (waiting(&a) == 0) 19 continue; 20 21 void* library = dlopen("/usr/lib/libpcre.dylib", RTLD_LAZY); 22 int (*pcre_config)(int, void *) = (int (*)(int, void *))dlsym(library, "pcre_config"); 23 if (pcre_config) { 24 int value; 25 pcre_config(PCRE_CONFIG_UTF8, &value); 26 } 27 dlclose(library); 28 29 return 0; 30} 31