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


C++ DynamicLibrary::open方法代码示例

本文整理汇总了C++中DynamicLibrary::open方法的典型用法代码示例。如果您正苦于以下问题:C++ DynamicLibrary::open方法的具体用法?C++ DynamicLibrary::open怎么用?C++ DynamicLibrary::open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DynamicLibrary的用法示例。


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

示例1: loadPlugin

// --- Plugin Loading ------------------------------------------------------ //
/// Loads a plugin from \p fileName. Returns \c false if an error
/// occurs.
bool PluginManager::loadPlugin(const std::string &fileName)
{
    DynamicLibrary *library = new DynamicLibrary;
    library->setFileName(fileName);
    bool ok = library->open();
    if(!ok){
        std::cerr << "PluginManager: Error: Failed to load plugin: (" << fileName << "):"
                  << library->errorString() << std::endl;

        return false;
    }

    typedef Plugin* (*InitFunction)();
    InitFunction initFunction = reinterpret_cast<InitFunction>(library->resolveFunction("chemkit_plugin_init"));
    if(!initFunction){
        std::cerr << "PluginManager: Error: Failed to load plugin: (" << fileName << "):"
                  << "Plugin contains no init() function." << std::endl;

        return false;
    }

    Plugin *plugin = initFunction();
    if(!plugin){
        std::cerr << "PluginManager: Error: Failed to load plugin: (" << fileName << "):"
                  << "Calling the plugin's init() function failed." << std::endl;

        return false;
    }

    plugin->setLibrary(library);

    d->plugins.push_back(plugin);

    return true;
}
开发者ID:NabilNoaman,项目名称:chemkit,代码行数:38,代码来源:pluginmanager.cpp

示例2: load_dynamicLib

static bool load_dynamicLib(const char *libname)
{
    if(dlclang_createIndex) return true;
    if(dynamicLib.open(libname))
    {
        //@write_dynamic_functions_load();
// generated-code:begin
dlclang_createIndex = (clang_createIndex_t) dynamicLib.dlsym("clang_createIndex");
if(!dlclang_createIndex) return false;
dlclang_disposeIndex = (clang_disposeIndex_t) dynamicLib.dlsym("clang_disposeIndex");
if(!dlclang_disposeIndex) return false;
dlclang_parseTranslationUnit = (clang_parseTranslationUnit_t) dynamicLib.dlsym("clang_parseTranslationUnit");
if(!dlclang_parseTranslationUnit) return false;
dlclang_getTranslationUnitCursor = (clang_getTranslationUnitCursor_t) dynamicLib.dlsym("clang_getTranslationUnitCursor");
if(!dlclang_getTranslationUnitCursor) return false;
dlclang_disposeTranslationUnit = (clang_disposeTranslationUnit_t) dynamicLib.dlsym("clang_disposeTranslationUnit");
if(!dlclang_disposeTranslationUnit) return false;
dlclang_visitChildren = (clang_visitChildren_t) dynamicLib.dlsym("clang_visitChildren");
if(!dlclang_visitChildren) return false;
dlclang_getCursorKind = (clang_getCursorKind_t) dynamicLib.dlsym("clang_getCursorKind");
if(!dlclang_getCursorKind) return false;
dlclang_getCursorType = (clang_getCursorType_t) dynamicLib.dlsym("clang_getCursorType");
if(!dlclang_getCursorType) return false;
dlclang_getCursorSpelling = (clang_getCursorSpelling_t) dynamicLib.dlsym("clang_getCursorSpelling");
if(!dlclang_getCursorSpelling) return false;
dlclang_getTypeSpelling = (clang_getTypeSpelling_t) dynamicLib.dlsym("clang_getTypeSpelling");
if(!dlclang_getTypeSpelling) return false;
dlclang_getCursorKindSpelling = (clang_getCursorKindSpelling_t) dynamicLib.dlsym("clang_getCursorKindSpelling");
if(!dlclang_getCursorKindSpelling) return false;
dlclang_getCursorReferenced = (clang_getCursorReferenced_t) dynamicLib.dlsym("clang_getCursorReferenced");
if(!dlclang_getCursorReferenced) return false;
dlclang_getCString = (clang_getCString_t) dynamicLib.dlsym("clang_getCString");
if(!dlclang_getCString) return false;
dlclang_disposeString = (clang_disposeString_t) dynamicLib.dlsym("clang_disposeString");
if(!dlclang_disposeString) return false;
dlclang_getCursorLocation = (clang_getCursorLocation_t) dynamicLib.dlsym("clang_getCursorLocation");
if(!dlclang_getCursorLocation) return false;
dlclang_getPresumedLocation = (clang_getPresumedLocation_t) dynamicLib.dlsym("clang_getPresumedLocation");
if(!dlclang_getPresumedLocation) return false;
dlclang_getCursorLinkage = (clang_getCursorLinkage_t) dynamicLib.dlsym("clang_getCursorLinkage");
if(!dlclang_getCursorLinkage) return false;
dlclang_getResultType = (clang_getResultType_t) dynamicLib.dlsym("clang_getResultType");
if(!dlclang_getResultType) return false;
// generated-code:end

        return true;
    }
    return false;
}
开发者ID:mingodad,项目名称:squilu,代码行数:49,代码来源:sq_libclang.cpp

示例3: void

} TEST_END

TEST_BEGIN(base, dynamic_library) {

  DynamicLibrary dync;
  rc_t rc = dync.open(_STR("base_unittest.dll"));
  ASSERT_EQ(RC_S_OK, rc);

  typedef void (*PFN_TEST_CALL)();
  PFN_TEST_CALL pfn_call = dync.LocateSymbol<PFN_TEST_CALL>(_STR("base_dynamic_library_test"));
  ASSERT_NE(NULL, pfn_call);

  (pfn_call)();

  ASSERT_EQ(TRUE, gbCall);

} TEST_END
开发者ID:obabywawa,项目名称:logsystem,代码行数:17,代码来源:dynamic_library_unittest.cpp

示例4: open

 bool open()
 {
     module.open (file.getFullPathName());
     moduleMain = (LADSPA_Descriptor_Function) module.getFunction ("ladspa_descriptor");
     return moduleMain != nullptr;
 }
开发者ID:JayaWei,项目名称:ambix,代码行数:6,代码来源:juce_LADSPAPluginFormat.cpp

示例5: load_libmysqlclient

static bool load_libmysqlclient(const char *libName)
{
    if(dlmysql_init) return true;
    if(libmysqlclient.open(libName))
    {
        //@write_mysql_functions_load();
// generated-code:begin
dlmysql_init = (mysql_init_t) libmysqlclient.dlsym("mysql_init");
if(!dlmysql_init) return false;
dlmysql_real_connect = (mysql_real_connect_t) libmysqlclient.dlsym("mysql_real_connect");
if(!dlmysql_real_connect) return false;
dlmysql_close = (mysql_close_t) libmysqlclient.dlsym("mysql_close");
if(!dlmysql_close) return false;
dlmysql_error = (mysql_error_t) libmysqlclient.dlsym("mysql_error");
if(!dlmysql_error) return false;
dlmysql_ping = (mysql_ping_t) libmysqlclient.dlsym("mysql_ping");
if(!dlmysql_ping) return false;
dlmysql_real_escape_string = (mysql_real_escape_string_t) libmysqlclient.dlsym("mysql_real_escape_string");
if(!dlmysql_real_escape_string) return false;
dlmysql_get_server_version = (mysql_get_server_version_t) libmysqlclient.dlsym("mysql_get_server_version");
if(!dlmysql_get_server_version) return false;
dlmysql_insert_id = (mysql_insert_id_t) libmysqlclient.dlsym("mysql_insert_id");
if(!dlmysql_insert_id) return false;
dlmysql_data_seek = (mysql_data_seek_t) libmysqlclient.dlsym("mysql_data_seek");
if(!dlmysql_data_seek) return false;
dlmysql_store_result = (mysql_store_result_t) libmysqlclient.dlsym("mysql_store_result");
if(!dlmysql_store_result) return false;
dlmysql_real_query = (mysql_real_query_t) libmysqlclient.dlsym("mysql_real_query");
if(!dlmysql_real_query) return false;
dlmysql_num_rows = (mysql_num_rows_t) libmysqlclient.dlsym("mysql_num_rows");
if(!dlmysql_num_rows) return false;
dlmysql_affected_rows = (mysql_affected_rows_t) libmysqlclient.dlsym("mysql_affected_rows");
if(!dlmysql_affected_rows) return false;
dlmysql_num_fields = (mysql_num_fields_t) libmysqlclient.dlsym("mysql_num_fields");
if(!dlmysql_num_fields) return false;
dlmysql_fetch_fields = (mysql_fetch_fields_t) libmysqlclient.dlsym("mysql_fetch_fields");
if(!dlmysql_fetch_fields) return false;
dlmysql_fetch_field_direct = (mysql_fetch_field_direct_t) libmysqlclient.dlsym("mysql_fetch_field_direct");
if(!dlmysql_fetch_field_direct) return false;
dlmysql_fetch_row = (mysql_fetch_row_t) libmysqlclient.dlsym("mysql_fetch_row");
if(!dlmysql_fetch_row) return false;
dlmysql_fetch_lengths = (mysql_fetch_lengths_t) libmysqlclient.dlsym("mysql_fetch_lengths");
if(!dlmysql_fetch_lengths) return false;
dlmysql_free_result = (mysql_free_result_t) libmysqlclient.dlsym("mysql_free_result");
if(!dlmysql_free_result) return false;
dlmysql_eof = (mysql_eof_t) libmysqlclient.dlsym("mysql_eof");
if(!dlmysql_eof) return false;
dlmysql_stmt_init = (mysql_stmt_init_t) libmysqlclient.dlsym("mysql_stmt_init");
if(!dlmysql_stmt_init) return false;
dlmysql_stmt_prepare = (mysql_stmt_prepare_t) libmysqlclient.dlsym("mysql_stmt_prepare");
if(!dlmysql_stmt_prepare) return false;
dlmysql_stmt_execute = (mysql_stmt_execute_t) libmysqlclient.dlsym("mysql_stmt_execute");
if(!dlmysql_stmt_execute) return false;
dlmysql_stmt_param_count = (mysql_stmt_param_count_t) libmysqlclient.dlsym("mysql_stmt_param_count");
if(!dlmysql_stmt_param_count) return false;
dlmysql_stmt_bind_param = (mysql_stmt_bind_param_t) libmysqlclient.dlsym("mysql_stmt_bind_param");
if(!dlmysql_stmt_bind_param) return false;
dlmysql_stmt_reset = (mysql_stmt_reset_t) libmysqlclient.dlsym("mysql_stmt_reset");
if(!dlmysql_stmt_reset) return false;
dlmysql_stmt_free_result = (mysql_stmt_free_result_t) libmysqlclient.dlsym("mysql_stmt_free_result");
if(!dlmysql_stmt_free_result) return false;
dlmysql_stmt_close = (mysql_stmt_close_t) libmysqlclient.dlsym("mysql_stmt_close");
if(!dlmysql_stmt_close) return false;
dlmysql_stmt_error = (mysql_stmt_error_t) libmysqlclient.dlsym("mysql_stmt_error");
if(!dlmysql_stmt_error) return false;
// generated-code:end

        return true;
    }
    return false;
}
开发者ID:mingodad,项目名称:squilu,代码行数:71,代码来源:sq_mysql.cpp

示例6: isOpenSLAvailable

bool isOpenSLAvailable()
{
    DynamicLibrary library;
    return library.open ("libOpenSLES.so");
}
开发者ID:oeberhard,项目名称:BAVSN,代码行数:5,代码来源:juce_android_OpenSL.cpp


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