本文整理汇总了C++中PR_FindFunctionSymbol函数的典型用法代码示例。如果您正苦于以下问题:C++ PR_FindFunctionSymbol函数的具体用法?C++ PR_FindFunctionSymbol怎么用?C++ PR_FindFunctionSymbol使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PR_FindFunctionSymbol函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: LoadGtkModule
static nsresult
LoadGtkModule(GnomeAccessibilityModule& aModule)
{
NS_ENSURE_ARG(aModule.libName);
if (!(aModule.lib = PR_LoadLibrary(aModule.libName))) {
MAI_LOG_DEBUG(("Fail to load lib: %s in default path\n", aModule.libName));
//try to load the module with "gtk-2.0/modules" appended
char *curLibPath = PR_GetLibraryPath();
nsCAutoString libPath(curLibPath);
#if defined(LINUX) && defined(__x86_64__)
libPath.Append(":/usr/lib64:/usr/lib");
#else
libPath.Append(":/usr/lib");
#endif
MAI_LOG_DEBUG(("Current Lib path=%s\n", libPath.get()));
PR_FreeLibraryName(curLibPath);
PRInt16 loc1 = 0, loc2 = 0;
PRInt16 subLen = 0;
while (loc2 >= 0) {
loc2 = libPath.FindChar(':', loc1);
if (loc2 < 0)
subLen = libPath.Length() - loc1;
else
subLen = loc2 - loc1;
nsCAutoString sub(Substring(libPath, loc1, subLen));
sub.Append("/gtk-2.0/modules/");
sub.Append(aModule.libName);
aModule.lib = PR_LoadLibrary(sub.get());
if (aModule.lib) {
MAI_LOG_DEBUG(("Ok, load %s from %s\n", aModule.libName, sub.get()));
break;
}
loc1 = loc2+1;
}
if (!aModule.lib) {
MAI_LOG_DEBUG(("Fail to load %s\n", aModule.libName));
return NS_ERROR_FAILURE;
}
}
//we have loaded the library, try to get the function ptrs
if (!(aModule.init = PR_FindFunctionSymbol(aModule.lib,
aModule.initName)) ||
!(aModule.shutdown = PR_FindFunctionSymbol(aModule.lib,
aModule.shutdownName))) {
//fail, :(
MAI_LOG_DEBUG(("Fail to find symbol %s in %s",
aModule.init ? aModule.shutdownName : aModule.initName,
aModule.libName));
PR_UnloadLibrary(aModule.lib);
aModule.lib = NULL;
return NS_ERROR_FAILURE;
}
return NS_OK;
}
开发者ID:LittleForker,项目名称:mozilla-central,代码行数:60,代码来源:nsApplicationAccessibleWrap.cpp
示例2: Initialize
static void Initialize()
{
if (!GDK_IS_X11_DISPLAY(gdk_display_get_default()))
return;
// This will leak - See comments in ~nsIdleServiceGTK().
PRLibrary* xsslib = PR_LoadLibrary("libXss.so.1");
if (!xsslib) // ouch.
{
#ifdef PR_LOGGING
PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to find libXss.so!\n"));
#endif
return;
}
_XSSQueryExtension = (_XScreenSaverQueryExtension_fn)
PR_FindFunctionSymbol(xsslib, "XScreenSaverQueryExtension");
_XSSAllocInfo = (_XScreenSaverAllocInfo_fn)
PR_FindFunctionSymbol(xsslib, "XScreenSaverAllocInfo");
_XSSQueryInfo = (_XScreenSaverQueryInfo_fn)
PR_FindFunctionSymbol(xsslib, "XScreenSaverQueryInfo");
#ifdef PR_LOGGING
if (!_XSSQueryExtension)
PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryExtension!\n"));
if (!_XSSAllocInfo)
PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSAllocInfo!\n"));
if (!_XSSQueryInfo)
PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryInfo!\n"));
#endif
sInitialized = true;
}
开发者ID:LordJZ,项目名称:gecko-dev,代码行数:32,代码来源:nsIdleServiceGTK.cpp
示例3: ProcessModule
static void
ProcessModule(const char *modulesDir, const char *fileName)
{
int dLen = strlen(modulesDir);
int fLen = strlen(fileName);
char *buf = (char *) malloc(dLen + 1 + fLen + 1);
memcpy(buf, modulesDir, dLen);
buf[dLen] = kPathSep;
memcpy(buf + dLen + 1, fileName, fLen);
buf[dLen + 1 + fLen] = '\0';
PRLibrary *lib = PR_LoadLibrary(buf);
if (lib) {
EntryPoint initFunc = (EntryPoint) PR_FindFunctionSymbol(lib, kInitMethod);
EntryPoint testFunc = (EntryPoint) PR_FindFunctionSymbol(lib, kTestMethod);
EntryPoint shutdownFunc = (EntryPoint) PR_FindFunctionSymbol(lib, kShutdownMethod);
if (testFunc) {
int rv = 0;
if (initFunc)
rv = initFunc();
// don't run test case if init fails.
if (rv == 0)
testFunc();
if (shutdownFunc)
shutdownFunc();
}
PR_UnloadLibrary(lib);
}
free(buf);
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:33,代码来源:Testy.cpp
示例4: ensure_libgnomeui
static nsresult
ensure_libgnomeui()
{
// Attempt to get the libgnomeui symbol references. We do it this way so that stock icons from Init()
// don't get held back by InitWithGnome()'s libgnomeui dependency.
if (!gTriedToLoadGnomeLibs) {
gLibGnomeUI = PR_LoadLibrary("libgnomeui-2.so.0");
if (!gLibGnomeUI)
return NS_ERROR_NOT_AVAILABLE;
_gnome_init = (_GnomeInit_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_init_with_popt_table");
_gnome_icon_theme_new = (_GnomeIconThemeNew_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_icon_theme_new");
_gnome_icon_lookup = (_GnomeIconLookup_fn)PR_FindFunctionSymbol(gLibGnomeUI, "gnome_icon_lookup");
if (!_gnome_init || !_gnome_icon_theme_new || !_gnome_icon_lookup) {
PR_UnloadLibrary(gLibGnomeUI);
gLibGnomeUI = nullptr;
return NS_ERROR_NOT_AVAILABLE;
}
}
if (!gLibGnomeUI)
return NS_ERROR_NOT_AVAILABLE;
return NS_OK;
}
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:26,代码来源:nsIconChannel.cpp
示例5: PR_LoadLibrary
void
nsApplicationAccessibleWrap::PreCreate()
{
if (!sATKChecked) {
sATKLib = PR_LoadLibrary(sATKLibName);
if (sATKLib) {
AtkGetTypeType pfn_atk_hyperlink_impl_get_type = (AtkGetTypeType) PR_FindFunctionSymbol(sATKLib, sATKHyperlinkImplGetTypeSymbol);
if (pfn_atk_hyperlink_impl_get_type)
g_atk_hyperlink_impl_type = pfn_atk_hyperlink_impl_get_type();
AtkGetTypeType pfn_atk_socket_get_type;
pfn_atk_socket_get_type = (AtkGetTypeType)
PR_FindFunctionSymbol(sATKLib,
AtkSocketAccessible::sATKSocketGetTypeSymbol);
if (pfn_atk_socket_get_type) {
AtkSocketAccessible::g_atk_socket_type =
pfn_atk_socket_get_type();
AtkSocketAccessible::g_atk_socket_embed = (AtkSocketEmbedType)
PR_FindFunctionSymbol(sATKLib,
AtkSocketAccessible
::sATKSocketEmbedSymbol);
AtkSocketAccessible::gCanEmbed =
AtkSocketAccessible::g_atk_socket_type != G_TYPE_INVALID &&
AtkSocketAccessible::g_atk_socket_embed;
}
}
sATKChecked = PR_TRUE;
}
}
开发者ID:gorakhargosh,项目名称:mozilla-central,代码行数:29,代码来源:nsApplicationAccessibleWrap.cpp
示例6: ssl_InitCngFunctions
static PRStatus
ssl_InitCngFunctions(void)
{
SECStatus rv;
ncrypt_library = PR_LoadLibrary("ncrypt.dll");
if (ncrypt_library == NULL)
goto loser;
pNCryptFreeObject = (NCryptFreeObjectFunc)PR_FindFunctionSymbol(
ncrypt_library, "NCryptFreeObject");
if (pNCryptFreeObject == NULL)
goto loser;
pNCryptSignHash = (NCryptSignHashFunc)PR_FindFunctionSymbol(
ncrypt_library, "NCryptSignHash");
if (pNCryptSignHash == NULL)
goto loser;
rv = NSS_RegisterShutdown(ssl_ShutdownCngFunctions, NULL);
if (rv != SECSuccess)
goto loser;
return PR_SUCCESS;
loser:
pNCryptSignHash = NULL;
pNCryptFreeObject = NULL;
if (ncrypt_library) {
PR_UnloadLibrary(ncrypt_library);
ncrypt_library = NULL;
}
return PR_FAILURE;
}
开发者ID:AutomationConsultant,项目名称:perch-webrtc,代码行数:35,代码来源:sslplatf.c
示例7: GMP_LOG
GMPErr
ChromiumCDMAdapter::GMPInit(const GMPPlatformAPI* aPlatformAPI)
{
GMP_LOG("ChromiumCDMAdapter::GMPInit");
sPlatform = aPlatformAPI;
if (!mLib) {
return GMPGenericErr;
}
#ifdef MOZILLA_OFFICIAL
// Note: we must call the VerifyCdmHost_0 function if it's present before
// we call the initialize function.
auto verify = reinterpret_cast<decltype(::VerifyCdmHost_0)*>(
PR_FindFunctionSymbol(mLib, STRINGIFY(VerifyCdmHost_0)));
if (verify) {
nsTArray<cdm::HostFile> files;
for (HostFileData& hostFile : mHostFiles) {
files.AppendElement(TakeToCDMHostFile(hostFile));
}
bool result = verify(files.Elements(), files.Length());
GMP_LOG("%s VerifyCdmHost_0 returned %d", __func__, result);
}
#endif
auto init = reinterpret_cast<decltype(::INITIALIZE_CDM_MODULE)*>(
PR_FindFunctionSymbol(mLib, STRINGIFY(INITIALIZE_CDM_MODULE)));
if (!init) {
return GMPGenericErr;
}
GMP_LOG(STRINGIFY(INITIALIZE_CDM_MODULE) "()");
init();
return GMPNoErr;
}
开发者ID:fitzgen,项目名称:gecko-dev,代码行数:35,代码来源:ChromiumCDMAdapter.cpp
示例8: pluginPath
bool
GMPChild::LoadPluginLibrary(const std::string& aPluginPath)
{
nsDependentCString pluginPath(aPluginPath.c_str());
nsCOMPtr<nsIFile> libFile;
nsresult rv = NS_NewNativeLocalFile(pluginPath, true, getter_AddRefs(libFile));
if (NS_FAILED(rv)) {
return false;
}
nsAutoString leafName;
if (NS_FAILED(libFile->GetLeafName(leafName))) {
return false;
}
nsAutoString baseName(Substring(leafName, 4, leafName.Length() - 1));
#if defined(XP_MACOSX)
nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".dylib");
#elif defined(OS_POSIX)
nsAutoString binaryName = NS_LITERAL_STRING("lib") + baseName + NS_LITERAL_STRING(".so");
#elif defined(XP_WIN)
nsAutoString binaryName = baseName + NS_LITERAL_STRING(".dll");
#else
#error not defined
#endif
libFile->AppendRelativePath(binaryName);
nsAutoCString nativePath;
libFile->GetNativePath(nativePath);
mLib = PR_LoadLibrary(nativePath.get());
if (!mLib) {
return false;
}
GMPInitFunc initFunc = reinterpret_cast<GMPInitFunc>(PR_FindFunctionSymbol(mLib, "GMPInit"));
if (!initFunc) {
return false;
}
auto platformAPI = new GMPPlatformAPI();
InitPlatformAPI(*platformAPI);
if (initFunc(platformAPI) != GMPNoErr) {
return false;
}
mGetAPIFunc = reinterpret_cast<GMPGetAPIFunc>(PR_FindFunctionSymbol(mLib, "GMPGetAPI"));
if (!mGetAPIFunc) {
return false;
}
return true;
}
开发者ID:Kunden,项目名称:gecko-dev,代码行数:54,代码来源:GMPChild.cpp
示例9: PR_LoadLibrary
NS_IMETHODIMP
nsSound::Init()
{
// This function is designed so that no library is compulsory, and
// one library missing doesn't cause the other(s) to not be used.
if (mInited)
return NS_OK;
mInited = true;
if (!libcanberra) {
libcanberra = PR_LoadLibrary("libcanberra.so.0");
if (libcanberra) {
ca_context_create = (ca_context_create_fn) PR_FindFunctionSymbol(libcanberra, "ca_context_create");
if (!ca_context_create) {
PR_UnloadLibrary(libcanberra);
libcanberra = nullptr;
} else {
// at this point we know we have a good libcanberra library
ca_context_destroy = (ca_context_destroy_fn) PR_FindFunctionSymbol(libcanberra, "ca_context_destroy");
ca_context_play = (ca_context_play_fn) PR_FindFunctionSymbol(libcanberra, "ca_context_play");
ca_context_change_props = (ca_context_change_props_fn) PR_FindFunctionSymbol(libcanberra, "ca_context_change_props");
ca_proplist_create = (ca_proplist_create_fn) PR_FindFunctionSymbol(libcanberra, "ca_proplist_create");
ca_proplist_destroy = (ca_proplist_destroy_fn) PR_FindFunctionSymbol(libcanberra, "ca_proplist_destroy");
ca_proplist_sets = (ca_proplist_sets_fn) PR_FindFunctionSymbol(libcanberra, "ca_proplist_sets");
ca_context_play_full = (ca_context_play_full_fn) PR_FindFunctionSymbol(libcanberra, "ca_context_play_full");
}
}
}
return NS_OK;
}
开发者ID:hideakihata,项目名称:mozilla-central.fgv,代码行数:32,代码来源:nsSound.cpp
示例10: fopen
GMPErr
WidevineAdapter::GMPInit(const GMPPlatformAPI* aPlatformAPI)
{
#ifdef ENABLE_WIDEVINE_LOG
if (getenv("GMP_LOG_FILE")) {
// Clear log file.
FILE* f = fopen(getenv("GMP_LOG_FILE"), "w");
if (f) {
fclose(f);
}
}
#endif
sPlatform = aPlatformAPI;
if (!mLib) {
return GMPGenericErr;
}
auto init = reinterpret_cast<decltype(::INITIALIZE_CDM_MODULE)*>(
PR_FindFunctionSymbol(mLib, STRINGIFY(INITIALIZE_CDM_MODULE)));
if (!init) {
return GMPGenericErr;
}
Log(STRINGIFY(INITIALIZE_CDM_MODULE)"()");
init();
return GMPNoErr;
}
开发者ID:glen61y141,项目名称:gecko-dev,代码行数:29,代码来源:WidevineAdapter.cpp
示例11: PR_FindFunctionSymbol
PRFuncPtr
GLLibraryLoader::LookupSymbol(PRLibrary *lib,
const char *sym,
PlatformLookupFunction lookupFunction)
{
PRFuncPtr res = 0;
// try finding it in the library directly, if we have one
if (lib) {
res = PR_FindFunctionSymbol(lib, sym);
}
// then try looking it up via the lookup symbol
if (!res && lookupFunction) {
res = lookupFunction(sym);
}
// finally just try finding it in the process
if (!res) {
PRLibrary *leakedLibRef;
res = PR_FindFunctionSymbolAndLibrary(sym, &leakedLibRef);
}
return res;
}
开发者ID:houzhenggang,项目名称:ExMail,代码行数:25,代码来源:GLLibraryLoader.cpp
示例12: GetJNIForThread
nsresult
PluginPRLibrary::NP_Initialize(NPNetscapeFuncs* bFuncs,
NPPluginFuncs* pFuncs, NPError* error)
{
JNIEnv* env = GetJNIForThread();
if (!env)
return NS_ERROR_FAILURE;
if (mNP_Initialize) {
*error = mNP_Initialize(bFuncs, pFuncs, env);
} else {
NP_InitializeFunc pfNP_Initialize = (NP_InitializeFunc)
PR_FindFunctionSymbol(mLibrary, "NP_Initialize");
if (!pfNP_Initialize)
return NS_ERROR_FAILURE;
*error = pfNP_Initialize(bFuncs, pFuncs, env);
}
// Save pointers to functions that get called through PluginLibrary itself.
mNPP_New = pFuncs->newp;
mNPP_GetValue = pFuncs->getvalue;
mNPP_ClearSiteData = pFuncs->clearsitedata;
mNPP_GetSitesWithData = pFuncs->getsiteswithdata;
return NS_OK;
}
开发者ID:PriceTseng,项目名称:mozilla-central,代码行数:25,代码来源:PluginPRLibrary.cpp
示例13: PR_LoadLibrary
NS_IMETHODIMP
nsSound::Init()
{
/* we don't need to do esd_open_sound if we are only going to play files
but we will if we want to do things like streams, etc
*/
if (mInited)
return NS_OK;
if (elib)
return NS_OK;
EsdOpenSoundType EsdOpenSound;
elib = PR_LoadLibrary("libesd.so.0");
if (!elib) return NS_ERROR_NOT_AVAILABLE;
EsdOpenSound = (EsdOpenSoundType) PR_FindFunctionSymbol(elib, "esd_open_sound");
if (!EsdOpenSound)
return NS_ERROR_FAILURE;
esdref = (*EsdOpenSound)("localhost");
if (!esdref)
return NS_ERROR_FAILURE;
mInited = PR_TRUE;
return NS_OK;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:30,代码来源:nsSound.cpp
示例14: LL_INIT
// Gets shell version as packed 64 bit int
PRUint64 nsDragService::GetShellVersion()
{
PRUint64 lVersion = LL_INIT(0, 0);
PRUint64 lMinor = lVersion;
// shell32.dll should be loaded already, so we ae not actually loading the library here
PRLibrary *libShell = PR_LoadLibrary("shell32.dll");
if (libShell == NULL)
return lVersion;
do
{
DLLGETVERSIONPROC versionProc = NULL;
versionProc = (DLLGETVERSIONPROC)PR_FindFunctionSymbol(libShell, "DllGetVersion");
if (versionProc == NULL)
break;
DLLVERSIONINFO versionInfo;
::ZeroMemory(&versionInfo, sizeof(DLLVERSIONINFO));
versionInfo.cbSize = sizeof(DLLVERSIONINFO);
if (FAILED(versionProc(&versionInfo)))
break;
// why is this?
LL_UI2L(lVersion, versionInfo.dwMajorVersion);
LL_SHL(lVersion, lVersion, 32);
LL_UI2L(lMinor, versionInfo.dwMinorVersion);
LL_OR2(lVersion, lMinor);
} while (false);
PR_UnloadLibrary(libShell);
libShell = NULL;
return lVersion;
}
开发者ID:mbrubeck,项目名称:mozilla-central,代码行数:36,代码来源:nsDragService.cpp
示例15: FT_Library_Version
gfxFT2LockedFace::CharVariantFunction
gfxFT2LockedFace::FindCharVariantFunction()
{
// This function is available from FreeType 2.3.6 (June 2008).
PRLibrary *lib = nsnull;
CharVariantFunction function =
reinterpret_cast<CharVariantFunction>
(PR_FindFunctionSymbolAndLibrary("FT_Face_GetCharVariantIndex", &lib));
if (!lib) {
return nsnull;
}
FT_Int major;
FT_Int minor;
FT_Int patch;
FT_Library_Version(mFace->glyph->library, &major, &minor, &patch);
// Versions 2.4.0 to 2.4.3 crash if configured with
// FT_CONFIG_OPTION_OLD_INTERNALS. Presence of the symbol FT_Alloc
// indicates FT_CONFIG_OPTION_OLD_INTERNALS.
if (major == 2 && minor == 4 && patch < 4 &&
PR_FindFunctionSymbol(lib, "FT_Alloc")) {
function = nsnull;
}
// Decrement the reference count incremented in
// PR_FindFunctionSymbolAndLibrary.
PR_UnloadLibrary(lib);
return function;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:31,代码来源:gfxFT2Utils.cpp
示例16: PR_FindFunctionSymbol
nsSound::~nsSound()
{
/* see above comment */
if (esdref != -1) {
EsdCloseType EsdClose = (EsdCloseType) PR_FindFunctionSymbol(elib, "esd_close");
if (EsdClose)
(*EsdClose)(esdref);
esdref = -1;
}
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:10,代码来源:nsSound.cpp
示例17: Initialize
static void Initialize()
{
sInitialized = true;
#if !defined(MOZ_PLATFORM_MAEMO) && defined(MOZ_X11)
// This will leak - See comments in ~nsIdleServiceQt().
PRLibrary* xsslib = PR_LoadLibrary("libXss.so.1");
if (!xsslib) {
return;
}
_XSSQueryExtension = (_XScreenSaverQueryExtension_fn)
PR_FindFunctionSymbol(xsslib, "XScreenSaverQueryExtension");
_XSSAllocInfo = (_XScreenSaverAllocInfo_fn)
PR_FindFunctionSymbol(xsslib, "XScreenSaverAllocInfo");
_XSSQueryInfo = (_XScreenSaverQueryInfo_fn)
PR_FindFunctionSymbol(xsslib, "XScreenSaverQueryInfo");
#endif
}
开发者ID:FunkyVerb,项目名称:devtools-window,代码行数:19,代码来源:nsIdleServiceQt.cpp
示例18: GMPSetNodeId
void GMPSetNodeId(const char* aNodeId, uint32_t aLength) override
{
if (!mLib) {
return;
}
GMPSetNodeIdFunc setNodeIdFunc = reinterpret_cast<GMPSetNodeIdFunc>(PR_FindFunctionSymbol(mLib, "GMPSetNodeId"));
if (setNodeIdFunc) {
setNodeIdFunc(aNodeId, aLength);
}
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:10,代码来源:GMPLoader.cpp
示例19: GMPInit
GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) override
{
if (!mLib) {
return GMPGenericErr;
}
GMPInitFunc initFunc = reinterpret_cast<GMPInitFunc>(PR_FindFunctionSymbol(mLib, "GMPInit"));
if (!initFunc) {
return GMPNotImplementedErr;
}
return initFunc(aPlatformAPI);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:11,代码来源:GMPLoader.cpp
示例20: GMPShutdown
void GMPShutdown() override
{
if (mLib) {
GMPShutdownFunc shutdownFunc = reinterpret_cast<GMPShutdownFunc>(PR_FindFunctionSymbol(mLib, "GMPShutdown"));
if (shutdownFunc) {
shutdownFunc();
}
PR_UnloadLibrary(mLib);
mLib = nullptr;
}
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:11,代码来源:GMPLoader.cpp
注:本文中的PR_FindFunctionSymbol函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论