예제 #1
0
static int
load_jack_lib(cubeb* context)
{
#ifdef DISABLE_LIBJACK_DLOPEN
  context->libjack = NULL;
#else
  context->libjack = dlopen("libjack.so.0", RTLD_LAZY);
  if (!context->libjack) {
    return CUBEB_ERROR;
  }

#define LOAD(x)                                         \
  {                                                     \
    api_##x = (typeof(x)*)dlsym(context->libjack, #x);  \
    if (!api_##x) {                                     \
      dlclose(context->libjack);                        \
      return CUBEB_ERROR;                               \
    }                                                   \
  }

  JACK_API_VISIT(LOAD);
#undef LOAD
#endif

  return CUBEB_OK;
}
예제 #2
0
static int
load_jack_lib(cubeb * context)
{
#ifdef __APPLE__
  context->libjack = dlopen("libjack.0.dylib", RTLD_LAZY);
  context->libjack = dlopen("/usr/local/lib/libjack.0.dylib", RTLD_LAZY);
#elif defined(__WIN32__)
# ifdef _WIN64
   context->libjack = LoadLibrary("libjack64.dll");
# else
   context->libjack = LoadLibrary("libjack.dll");
# endif
#else
  context->libjack = dlopen("libjack.so.0", RTLD_LAZY);
#endif
  if (!context->libjack) {
    return CUBEB_ERROR;
  }

#define LOAD(x)                                           \
  {                                                       \
    api_##x = (decltype(x)*)dlsym(context->libjack, #x);  \
    if (!api_##x) {                                       \
      dlclose(context->libjack);                          \
      return CUBEB_ERROR;                                 \
    }                                                     \
  }

  JACK_API_VISIT(LOAD);
#undef LOAD

  return CUBEB_OK;
}