MediaPluginHost::MediaPluginHost() { MOZ_COUNT_CTOR(MediaPluginHost); const char* name = GetOmxLibraryName(); ALOG("Loading OMX Plugin: %s", name ? name : "nullptr"); if (name) { char *path = PR_GetLibraryFilePathname("libxul.so", (PRFuncPtr) GetOmxLibraryName); PRLibrary *lib = NULL; if (path) { nsAutoCString libpath(path); PR_Free(path); int32_t slash = libpath.RFindChar('/'); if (slash != kNotFound) { libpath.Truncate(slash + 1); libpath.Append(name); lib = PR_LoadLibrary(libpath.get()); } } if (!lib) lib = PR_LoadLibrary(name); if (lib) { Manifest *manifest = static_cast<Manifest *>(PR_FindSymbol(lib, "MPAPI_MANIFEST")); if (manifest) { mPlugins.AppendElement(manifest); ALOG("OMX plugin successfully loaded"); } } } }
void Project::AddLibrary(const char *path) { if (!path) return; DPath libpath(path); if (!BEntry(libpath.GetFullPath()).Exists()) { libpath = FindLibrary(libpath.GetFileName()); if (libpath.IsEmpty()) { if (gBuildMode) { printf("%s seems to be missing\n", path); } else { BString err; err << path << " seems to be missing. Do you want to remove it from the project?"; int32 result = ShowAlert(err.String(),"Remove","Keep"); if (result == 0) return; } } } if (!HasLibrary(libpath.GetFullPath())) { STRACE(1,("%s: Added library %s\n",GetName(),libpath.GetFullPath())); fLibraryList.AddItem(gFileFactory.CreateSourceFileItem(libpath.GetFullPath())); } }
int WebEmberRunner::runEmber(std::string windowhandle) { FBLOG_INFO("WebEmberRunner::runEmber", "Starting Ember."); std::string prefix(getPrefix()); #ifdef USE_X11 std::string libpath(prefix + "/lib"); //change directory for rpath compatibility. chdir(libpath.c_str()); #endif if (mLinker.link(prefix.c_str()) == 0) { int ret = mLinker.callRunEmber(windowhandle.c_str(), prefix.c_str()); if (ret) { FBLOG_INFO("WebEmberRunner::runEmber", "Shut down WebEmber with error code: " << ret); } else { FBLOG_INFO("WebEmberRunner::runEmber", "Shut down WebEmber normally."); } } //send quit to message queue { WebEmberMessageQueuePtr queue(mQueue.lock()); if (queue) { queue->stop(); } } mLinker.unlink(); sRunning = false; return 0; }
int main(int argc, char* argv[]) { int ch, max_loop = 10, max_connections = 10; acl::string addr("127.0.0.1:9001"), libpath("../libpolarssl.so"); acl::acl_cpp_init(); while ((ch = getopt(argc, argv, "hd:s:n:c:")) > 0) { switch (ch) { case 'h': usage(argv[0]); return 0; case 'd': libpath = optarg; break; case 's': addr = optarg; break; case 'n': max_loop = atoi(optarg); break; case 'c': max_connections = atoi(optarg); break; default: break; } } acl::polarssl_conf::set_libpath(libpath); acl::polarssl_conf::load(); __ssl_conf = new acl::polarssl_conf; if (max_connections <= 0) max_connections = 100; for (int i = 0; i < max_connections; i++) { if (test(addr, i, max_loop) == false) break; } printf("Over, enter any key to exit!\n"); getchar(); delete __ssl_conf; return (0); }
void Project::ImportLibrary(const char *path, const platform_t &platform) { DPath libpath(path); BString filename = libpath.GetFileName(); BPath systemLibPath; find_directory(B_BEOS_LIB_DIRECTORY,&systemLibPath); // Most of the problems stem from migrating from Zeta to any Haiku build, so handle the // common cases here switch (platform) { case PLATFORM_HAIKU_GCC4: { // Haiku GCC4 breaks tradition in renaming libstdc++.r4.so to libstdc++.so if (filename == "libstdc++.r4.so") { libpath = systemLibPath.Path(); libpath << "libstdc++.so"; } } case PLATFORM_HAIKU: case PLATFORM_R5: case PLATFORM_ZETA: { // Haiku GCC4 breaks tradition in renaming libstdc++.r4.so to libstdc++.so, // so go back to the old naming scheme for the other platforms if (filename == "libstdc++.so") { libpath = systemLibPath.Path(); libpath << "libstdc++.r4.so"; } break; } default: { break; } } // libsupc++ is only for Haiku GCC4. It is not found or needed on other platforms, // so we will silently ignore any requests for the library on any other platform and // the code will build just fine. if (filename == "libsupc++.so" && platform != PLATFORM_HAIKU_GCC4) return; AddLibrary(libpath.GetFullPath()); }
// ************************************************************** //! \param // ************************************************************** std::pair<bool, std::string> ForthCLib::end() { if (!m_file) return ERR_UNBALANCED; m_file.close(); // Compile generated code into a dynamic library. std::string makefile = PathManager::instance().expand("forth/LibC/Makefile"); std::string command = "make -f " + makefile + " BUILD=" + config::tmp_path + " SRCS=" + m_libname + ".c" + " EXTLIBS=\"" + m_extlibs + "\""; system(command.c_str()); // FIXME: tester code de retour // Find symbols in the dynamic lib and create Forth entries in the dictionary. // FIXME: ok extension .so/.dylib pas necessaire avec gtkmm::Module mais utile pour les log std::string libpath(config::tmp_path + m_libname); m_module = new Glib::Module(libpath); if (!*m_module) return std::make_pair(false, "Failed loading shared libray '" + libpath + "'"); bool res = true; std::string msg; for (auto &it: m_functions) { void* func = nullptr; if (m_module->get_symbol(it.func_c_name, func)) { LOGD("Found symbol '%s' in '%s'", it.func_c_name.c_str(), libpath.c_str()); it.fun_ptr = reinterpret_cast<forth_c_function>(reinterpret_cast<long>(func)) ; } else { msg += ("Failed finding symbol '" + it.func_c_name + "' in '" + libpath + ".so\n"); //FIXME .so res = false; } } return std::make_pair(res, msg); }
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS]; logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF]; gDebug = boost::shared_ptr<amxDebug>(new amxDebug()); gDebug->Log("\tDebugging started\n"); gDebug->Log("-----------------------------------------------------------------"); gDebug->Log("Called plugin load | amx data: 0x%x | logprintf address: 0x%x", ppData[PLUGIN_DATA_AMX_EXPORTS], logprintf); gDebug->Log("-----------------------------------------------------------------\n"); gCore = boost::shared_ptr<amxCore>(new amxCore()); #if defined LINUX boost::filesystem::path tmppath("plugins/_addon_tmp.so"); boost::filesystem::path libpath("plugins/addon.so"); boost::filesystem::path curcfg("server.cfg"); boost::filesystem::path tmpcfg("server.cfg.bak"); #else boost::filesystem::path tmppath(".\\plugins\\_addon_tmp.dll"); boost::filesystem::path libpath(".\\plugins\\addon.dll"); boost::filesystem::path curcfg(".\\server.cfg"); boost::filesystem::path tmpcfg(".\\server.cfg.bak"); #endif if(boost::filesystem::exists(tmppath) && boost::filesystem::exists(tmpcfg)) { try { boost::filesystem::remove(libpath); boost::filesystem::copy_file(tmppath, libpath); boost::filesystem::remove(curcfg); boost::filesystem::rename(tmpcfg, curcfg); } catch(boost::filesystem::filesystem_error& error) { logprintf("SAMP-Addon warning: When updating addon binary: %s", error.what()); } logprintf("SAMP-Addon warning: Addon binary was updated. Start server again."); exit(EXIT_SUCCESS); } else if(boost::filesystem::exists(tmppath) && !boost::filesystem::exists(tmpcfg)) { try { boost::filesystem::remove(tmppath); } catch(boost::filesystem::filesystem_error& error) { logprintf("SAMP-Addon warning: Cannot remove old addon binary, remove it manually (What: %s)", error.what()); } logprintf("SAMP-Addon warning: old addon binary was removed"); } logprintf(" SAMP-Addon was loaded"); return true; }
int main(int argc, char **argv) #endif { char *cp; if(argc < 2) { cerr << "use: audiotool --option [args...]" << endl; exit(-1); } ++argv; cp = *argv; if(!strncmp(cp, "--", 2)) ++cp; #ifdef W32 SetConsoleCtrlHandler(down, TRUE); #else signal(SIGINT, down); signal(SIGTERM, down); signal(SIGQUIT, down); signal(SIGABRT, down); #endif if(!stricmp(cp, "-version")) version(); else if(!stricmp(cp, "-modpath") || !stricmp(cp, "-path")) libpath(); else if(!stricmp(cp, "-endian")) endian(); else if(!stricmp(cp, "-soundcard")) { if(*(++argv)) soundcard(atoi(*argv)); else soundcard(0); } #ifdef CODEC_MODFLAGS else if(!stricmp(cp, "-modflags")) modflags(); #endif #ifdef AUDIO_LIBRARY else if(!stricmp(cp, "-ldflags")) ldflags(); #endif else if(!stricmp(cp, "-info")) Tool::info(++argv); else if(!stricmp(cp, "-size")) Tool::size(++argv); else if(!stricmp(cp, "-notation") || !stricmp(cp, "-annotation")) Tool::notation(++argv); else if(!stricmp(cp, "-chart")) Tool::chart(++argv); else if(!stricmp(cp, "-strip")) Tool::strip(++argv); else if(!stricmp(cp, "-trim")) Tool::trim(++argv); else if(!stricmp(cp, "-build")) Tool::build(++argv); else if(!stricmp(cp, "-append")) Tool::append(++argv); else if(!stricmp(cp, "-play")) Tool::play(++argv); else if(!stricmp(cp, "-packets")) Tool::packetdump(++argv); cerr << "audiotool: " << *argv << ": unknown option" << endl; exit(-1); }