当前位置: 首页>>代码示例>>C++>>正文


C++ LOAD_FUNC函数代码示例

本文整理汇总了C++中LOAD_FUNC函数的典型用法代码示例。如果您正苦于以下问题:C++ LOAD_FUNC函数的具体用法?C++ LOAD_FUNC怎么用?C++ LOAD_FUNC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOAD_FUNC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadLibraryA

void *DSoundLoad(void)
{
    if(!ds_handle)
    {
#ifdef _WIN32
        ds_handle = LoadLibraryA("dsound.dll");
        if(ds_handle == NULL)
        {
            AL_PRINT("Failed to load dsound.dll\n");
            return NULL;
        }

#define LOAD_FUNC(f) do { \
    p##f = (void*)GetProcAddress((HMODULE)ds_handle, #f); \
    if(p##f == NULL) \
    { \
        FreeLibrary(ds_handle); \
        ds_handle = NULL; \
        AL_PRINT("Could not load %s from dsound.dll\n", #f); \
        return NULL; \
    } \
} while(0)
#else
        ds_handle = (void*)0xDEADBEEF;
#define LOAD_FUNC(f) p##f = f
#endif

LOAD_FUNC(DirectSoundCreate);
LOAD_FUNC(DirectSoundEnumerateA);
#undef LOAD_FUNC
    }
    return ds_handle;
}
开发者ID:3dseals,项目名称:furseal,代码行数:33,代码来源:dsound.c

示例2: DSoundLoad

static ALCboolean DSoundLoad(void)
{
    if(!ds_handle)
    {
        ds_handle = LoadLib("dsound.dll");
        if(ds_handle == NULL)
        {
            ERR("Failed to load dsound.dll\n");
            return ALC_FALSE;
        }

#define LOAD_FUNC(f) do {                                                     \
    p##f = GetSymbol(ds_handle, #f);                                          \
    if(p##f == NULL) {                                                        \
        CloseLib(ds_handle);                                                  \
        ds_handle = NULL;                                                     \
        return ALC_FALSE;                                                     \
    }                                                                         \
} while(0)
        LOAD_FUNC(DirectSoundCreate);
        LOAD_FUNC(DirectSoundEnumerateA);
        LOAD_FUNC(DirectSoundCaptureCreate);
        LOAD_FUNC(DirectSoundCaptureEnumerateA);
#undef LOAD_FUNC
    }
    return ALC_TRUE;
}
开发者ID:WoodenHaptics,项目名称:woody-experimental,代码行数:27,代码来源:dsound.c

示例3: pa_load

static ALCboolean pa_load(void)
{
    PaError err;

#ifdef HAVE_DYNLOAD
    if(!pa_handle)
    {
#ifdef _WIN32
# define PALIB "portaudio.dll"
#elif defined(__APPLE__) && defined(__MACH__)
# define PALIB "libportaudio.2.dylib"
#elif defined(__OpenBSD__)
# define PALIB "libportaudio.so"
#else
# define PALIB "libportaudio.so.2"
#endif

        pa_handle = LoadLib(PALIB);
        if(!pa_handle)
            return ALC_FALSE;

#define LOAD_FUNC(f) do {                                                     \
    p##f = GetSymbol(pa_handle, #f);                                          \
    if(p##f == NULL)                                                          \
    {                                                                         \
        CloseLib(pa_handle);                                                  \
        pa_handle = NULL;                                                     \
        return ALC_FALSE;                                                     \
    }                                                                         \
} while(0)
        LOAD_FUNC(Pa_Initialize);
        LOAD_FUNC(Pa_Terminate);
        LOAD_FUNC(Pa_GetErrorText);
        LOAD_FUNC(Pa_StartStream);
        LOAD_FUNC(Pa_StopStream);
        LOAD_FUNC(Pa_OpenStream);
        LOAD_FUNC(Pa_CloseStream);
        LOAD_FUNC(Pa_GetDefaultOutputDevice);
        LOAD_FUNC(Pa_GetDefaultInputDevice);
        LOAD_FUNC(Pa_GetStreamInfo);
#undef LOAD_FUNC

        if((err=Pa_Initialize()) != paNoError)
        {
            ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
            CloseLib(pa_handle);
            pa_handle = NULL;
            return ALC_FALSE;
        }
    }
#else
    if((err=Pa_Initialize()) != paNoError)
    {
        ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
        return ALC_FALSE;
    }
#endif
    return ALC_TRUE;
}
开发者ID:Wemersive,项目名称:openal-soft,代码行数:59,代码来源:portaudio.c

示例4: defined

bool PortBackendFactory::init()
{
    PaError err;

#ifdef HAVE_DYNLOAD
    if(!pa_handle)
    {
#ifdef _WIN32
# define PALIB "portaudio.dll"
#elif defined(__APPLE__) && defined(__MACH__)
# define PALIB "libportaudio.2.dylib"
#elif defined(__OpenBSD__)
# define PALIB "libportaudio.so"
#else
# define PALIB "libportaudio.so.2"
#endif

        pa_handle = LoadLib(PALIB);
        if(!pa_handle)
            return false;

#define LOAD_FUNC(f) do {                                                     \
    p##f = reinterpret_cast<decltype(p##f)>(GetSymbol(pa_handle, #f));        \
    if(p##f == nullptr)                                                       \
    {                                                                         \
        CloseLib(pa_handle);                                                  \
        pa_handle = nullptr;                                                  \
        return false;                                                         \
    }                                                                         \
} while(0)
        LOAD_FUNC(Pa_Initialize);
        LOAD_FUNC(Pa_Terminate);
        LOAD_FUNC(Pa_GetErrorText);
        LOAD_FUNC(Pa_StartStream);
        LOAD_FUNC(Pa_StopStream);
        LOAD_FUNC(Pa_OpenStream);
        LOAD_FUNC(Pa_CloseStream);
        LOAD_FUNC(Pa_GetDefaultOutputDevice);
        LOAD_FUNC(Pa_GetDefaultInputDevice);
        LOAD_FUNC(Pa_GetStreamInfo);
#undef LOAD_FUNC

        if((err=Pa_Initialize()) != paNoError)
        {
            ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
            CloseLib(pa_handle);
            pa_handle = nullptr;
            return false;
        }
    }
#else
    if((err=Pa_Initialize()) != paNoError)
    {
        ERR("Pa_Initialize() returned an error: %s\n", Pa_GetErrorText(err));
        return false;
    }
#endif
    return true;
}
开发者ID:kcat,项目名称:openal-soft,代码行数:59,代码来源:portaudio.cpp

示例5: RegisterLibCommands

void RegisterLibCommands(void)
{
    KppBuildFunctionDynamic(LOAD_FUNC(IDF_VBXSETPROP), KpiVBXOpsLH,
                            EVAL_ARGS, CAT_WND | RET_STR);
    KppBuildFunctionDynamic(LOAD_FUNC(IDF_VBXREFRESH), KpiVBXOpsLH,
                            EVAL_ARGS, CAT_WND | RET_STR);
    KppBuildFunctionDynamic(LOAD_FUNC(IDF_VBXGETPROP), KpiVBXOpsLH,
                            EVAL_ARGS, CAT_WND | RET_STR);
}
开发者ID:thearttrooper,项目名称:KappaPC,代码行数:9,代码来源:VBXLIB.C

示例6: pa_load

void pa_load(void)
{
    const char *str;
    PaError err;

    if(load_count == 0)
    {
#ifdef HAVE_DLFCN_H
#if defined(__APPLE__) && defined(__MACH__)
# define PALIB "libportaudio.2.dylib"
#else
# define PALIB "libportaudio.so.2"
#endif
        pa_handle = dlopen(PALIB, RTLD_NOW);
        if(!pa_handle)
            return;
        dlerror();

#define LOAD_FUNC(f) do { \
    p##f = (typeof(f)*)dlsym(pa_handle, #f); \
    if((str=dlerror()) != NULL) \
    { \
        dlclose(pa_handle); \
        pa_handle = NULL; \
        AL_PRINT("Could not load %s from "PALIB": %s\n", #f, str); \
        return; \
    } \
} while(0)
#else
        str = NULL;
        pa_handle = (void*)0xDEADBEEF;
#define LOAD_FUNC(f) p##f = f
#endif

LOAD_FUNC(Pa_Initialize);
LOAD_FUNC(Pa_Terminate);
LOAD_FUNC(Pa_GetErrorText);
LOAD_FUNC(Pa_StartStream);
LOAD_FUNC(Pa_StopStream);
LOAD_FUNC(Pa_OpenStream);
LOAD_FUNC(Pa_CloseStream);
LOAD_FUNC(Pa_GetDefaultOutputDevice);
LOAD_FUNC(Pa_GetStreamInfo);

#undef LOAD_FUNC

        if((err=pPa_Initialize()) != paNoError)
        {
            AL_PRINT("Pa_Initialize() returned an error: %s\n", pPa_GetErrorText(err));
#ifdef HAVE_DLFCN_H
            dlclose(pa_handle);
#endif
            pa_handle = NULL;
            return;
        }
    }

    ++load_count;
}
开发者ID:SergeStinckwich,项目名称:openqwaq,代码行数:59,代码来源:portaudio.c

示例7: xmp_getattr

static int xmp_getattr(const char *path, struct stat *st)
{
    int res;

    LOAD_FUNC("getattr")
    lua_pushstring(L_VM, path);
    obj_pcall(1, 11, 0);
    err_pcall(res);

    res = lua_tointeger(L_VM, -11);

    st->st_mode = lua_tointeger(L_VM, -10);
    st->st_ino  = lua_tointeger(L_VM, -9);
    st->st_rdev = lua_tointeger(L_VM, -8);
    st->st_dev  = lua_tointeger(L_VM, -8);
    st->st_nlink= lua_tointeger(L_VM, -7);
    st->st_uid  = lua_tointeger(L_VM, -6);
    st->st_gid  = lua_tointeger(L_VM, -5);
    st->st_size = lua_tointeger(L_VM, -4);
    st->st_atime= lua_tointeger(L_VM, -3);
    st->st_mtime= lua_tointeger(L_VM, -2);
    st->st_ctime= lua_tointeger(L_VM, -1);

    /* Fill in fields not provided by Python lstat() */
    st->st_blksize= 4096;
    st->st_blocks= (st->st_size + 511)/512;

    EPILOGUE(11)

    return res;
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:31,代码来源:fuse.c

示例8: Init

    static void Init()
    {
#ifdef _WIN32
#define SNDFILE_LIB "libsndfile-1.dll"
#elif defined(__APPLE__)
#define SNDFILE_LIB "libsndfile.1.dylib"
#else
#define SNDFILE_LIB "libsndfile.so.1"
#endif
        sndfile_handle = OpenLib(SNDFILE_LIB);
        if(!sndfile_handle) return;

        LOAD_FUNC(sndfile_handle, sf_close);
        LOAD_FUNC(sndfile_handle, sf_open_virtual);
        LOAD_FUNC(sndfile_handle, sf_readf_short);
        LOAD_FUNC(sndfile_handle, sf_seek);
    }
开发者ID:GiR-Zippo,项目名称:GWAN-Engine,代码行数:17,代码来源:codec_sndfile.cpp

示例9: VIVANTE_VideoInit

int
VIVANTE_VideoInit(_THIS)
{
    SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata;

#if SDL_VIDEO_DRIVER_VIVANTE_VDK
    videodata->vdk_private = vdkInitialize();
    if (!videodata->vdk_private) {
        return SDL_SetError("vdkInitialize() failed");
    }
#else
    videodata->egl_handle = SDL_LoadObject("libEGL.so.1");
    if (!videodata->egl_handle) {
        videodata->egl_handle = SDL_LoadObject("libEGL.so");
        if (!videodata->egl_handle) {
            return -1;
        }
    }
#define LOAD_FUNC(NAME) \
    videodata->NAME = SDL_LoadFunction(videodata->egl_handle, #NAME); \
    if (!videodata->NAME) return -1;

    LOAD_FUNC(fbGetDisplay);
    LOAD_FUNC(fbGetDisplayByIndex);
    LOAD_FUNC(fbGetDisplayGeometry);
    LOAD_FUNC(fbGetDisplayInfo);
    LOAD_FUNC(fbDestroyDisplay);
    LOAD_FUNC(fbCreateWindow);
    LOAD_FUNC(fbGetWindowGeometry);
    LOAD_FUNC(fbGetWindowInfo);
    LOAD_FUNC(fbDestroyWindow);
#endif

    if (VIVANTE_SetupPlatform(_this) < 0) {
        return -1;
    }

    if (VIVANTE_AddVideoDisplays(_this) < 0) {
        return -1;
    }

    VIVANTE_UpdateDisplayScale(_this);

#ifdef SDL_INPUT_LINUXEV
    if (SDL_EVDEV_Init() < 0) {
        return -1;
    }
#endif

    return 0;
}
开发者ID:GWRon,项目名称:sdl.mod,代码行数:51,代码来源:SDL_vivantevideo.c

示例10: l_signal

static void l_signal(int i)
{						/* assert(i==SIGALRM); */

    int res;
     
    signal(i,SIG_DFL); /* reset */

    LOAD_FUNC("pulse")
    obj_pcall(0, 1, 0);
    err_pcall(res);
    EPILOGUE(1)
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:12,代码来源:fuse.c

示例11: xmp_rmdir

static int xmp_rmdir(const char *path)
{
    int res;

    LOAD_FUNC("rmdir")
    lua_pushstring(L_VM, path);
    obj_pcall(1, 1, 0);
    err_pcall(res);
    res = lua_tointeger(L_VM, -1);
    EPILOGUE(1);
    
    return res;
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:13,代码来源:fuse.c

示例12: xmp_removexattr

static int xmp_removexattr(const char *path, const char *name)
{
    int res;

    LOAD_FUNC("removexattr")
    lua_pushstring(L_VM, path);
    lua_pushstring(L_VM, name);
    obj_pcall(2, 1, 0);
    err_pcall(res);
    res = lua_tointeger(L_VM, -1);
    EPILOGUE(1);

    return res;
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:14,代码来源:fuse.c

示例13: xmp_fsyncdir

static int xmp_fsyncdir(const char *path, int isdatasync, struct fuse_file_info *fi)
{
    int res;

    LOAD_FUNC("syncdir")
    lua_pushstring(L_VM, path);
    lua_pushboolean(L_VM, isdatasync);
    lua_rawgeti(L_VM, LUA_REGISTRYINDEX, fi->fh); 
    obj_pcall(3, 1, 0);
    err_pcall(res);
    res = lua_tointeger(L_VM, -1);
    EPILOGUE(1);
    return res;
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:14,代码来源:fuse.c

示例14: xmp_link

static int xmp_link(const char *from, const char *to)
{
    int res;

    LOAD_FUNC("link")
    lua_pushstring(L_VM, from);
    lua_pushstring(L_VM, to);
    obj_pcall(2, 1, 0);
    err_pcall(res);
    res = lua_tointeger(L_VM, -1);
    EPILOGUE(1);

    return res;
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:14,代码来源:fuse.c

示例15: xmp_flush

static int xmp_flush(const char *path, struct fuse_file_info *fi)
{
    int res;

    LOAD_FUNC("flush")
    lua_pushstring(L_VM, path);
    lua_rawgeti(L_VM, LUA_REGISTRYINDEX, fi->fh); 
    obj_pcall(2, 1, 0);
    err_pcall(res);
    res = lua_tointeger(L_VM, -1);
    EPILOGUE(1);

    return res;
}
开发者ID:LuaAndC,项目名称:luafuse,代码行数:14,代码来源:fuse.c


注:本文中的LOAD_FUNC函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。