本文整理匯總了C++中CFBundleGetFunctionPointerForName函數的典型用法代碼示例。如果您正苦於以下問題:C++ CFBundleGetFunctionPointerForName函數的具體用法?C++ CFBundleGetFunctionPointerForName怎麽用?C++ CFBundleGetFunctionPointerForName使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了CFBundleGetFunctionPointerForName函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: uv__set_process_title
int uv__set_process_title(const char* title) {
#if TARGET_OS_IPHONE
return -1;
#else
typedef CFTypeRef (*LSGetCurrentApplicationASNType)(void);
typedef OSStatus (*LSSetApplicationInformationItemType)(int,
CFTypeRef,
CFStringRef,
CFStringRef,
CFDictionaryRef*);
CFBundleRef launch_services_bundle;
LSGetCurrentApplicationASNType ls_get_current_application_asn;
LSSetApplicationInformationItemType ls_set_application_information_item;
CFStringRef* display_name_key;
ProcessSerialNumber psn;
CFTypeRef asn;
CFStringRef display_name;
OSStatus err;
launch_services_bundle =
CFBundleGetBundleWithIdentifier(CFSTR("com.apple.LaunchServices"));
if (launch_services_bundle == NULL)
return -1;
ls_get_current_application_asn = (LSGetCurrentApplicationASNType)
CFBundleGetFunctionPointerForName(launch_services_bundle,
CFSTR("_LSGetCurrentApplicationASN"));
if (ls_get_current_application_asn == NULL)
return -1;
ls_set_application_information_item = (LSSetApplicationInformationItemType)
CFBundleGetFunctionPointerForName(launch_services_bundle,
CFSTR("_LSSetApplicationInformationItem"));
if (ls_set_application_information_item == NULL)
return -1;
display_name_key = CFBundleGetDataPointerForName(launch_services_bundle,
CFSTR("_kLSDisplayNameKey"));
if (display_name_key == NULL || *display_name_key == NULL)
return -1;
/* Force the process manager to initialize. */
GetCurrentProcess(&psn);
display_name = CFStringCreateWithCString(NULL, title, kCFStringEncodingUTF8);
asn = ls_get_current_application_asn();
err = ls_set_application_information_item(-2, /* Magic value. */
asn,
*display_name_key,
display_name,
NULL);
return (err == noErr) ? 0 : -1;
#endif /* !TARGET_OS_IPHONE */
}
示例2: path
bool PluginPackage::load()
{
if (m_isLoaded) {
m_loadCount++;
return true;
}
WTF::RetainPtr<CFStringRef> path(AdoptCF, m_path.createCFString());
WTF::RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.get(),
kCFURLPOSIXPathStyle, false));
m_module = CFBundleCreate(NULL, url.get());
if (!m_module || !CFBundleLoadExecutable(m_module)) {
LOG(Plugins, "%s not loaded", m_path.utf8().data());
return false;
}
m_isLoaded = true;
NP_GetEntryPointsFuncPtr NP_GetEntryPoints = 0;
NP_InitializeFuncPtr NP_Initialize;
NPError npErr;
NP_Initialize = (NP_InitializeFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Initialize"));
NP_GetEntryPoints = (NP_GetEntryPointsFuncPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_GetEntryPoints"));
m_NPP_Shutdown = (NPP_ShutdownProcPtr)CFBundleGetFunctionPointerForName(m_module, CFSTR("NP_Shutdown"));
if (!NP_Initialize || !NP_GetEntryPoints || !m_NPP_Shutdown)
goto abort;
memset(&m_pluginFuncs, 0, sizeof(m_pluginFuncs));
m_pluginFuncs.size = sizeof(m_pluginFuncs);
initializeBrowserFuncs();
npErr = NP_Initialize(&m_browserFuncs);
LOG_NPERROR(npErr);
if (npErr != NPERR_NO_ERROR)
goto abort;
npErr = NP_GetEntryPoints(&m_pluginFuncs);
LOG_NPERROR(npErr);
if (npErr != NPERR_NO_ERROR)
goto abort;
m_loadCount++;
return true;
abort:
unloadWithoutShutdown();
return false;
}
示例3: getMainEntry
PluginEntryProc getMainEntry ()
{
PluginEntryProc mainProc = 0;
#if _WIN32
mainProc = (PluginEntryProc)GetProcAddress ((HMODULE)module, "VSTPluginMain");
if (!mainProc)
mainProc = (PluginEntryProc)GetProcAddress ((HMODULE)module, "main");
#elif TARGET_API_MAC_CARBON
mainProc = (PluginEntryProc)CFBundleGetFunctionPointerForName ((CFBundleRef)module, CFSTR("VSTPluginMain"));
if (!mainProc)
mainProc = (PluginEntryProc)CFBundleGetFunctionPointerForName ((CFBundleRef)module, CFSTR("main_macho"));
#endif
return mainProc;
}
示例4: LoadGlxBundle
/*
* LoadGlxBundle
* The Quartz mode X server needs to dynamically load the appropriate
* bundle before initializing GLX.
*/
static void LoadGlxBundle(void)
{
CFBundleRef mainBundle;
CFStringRef bundleName;
CFURLRef bundleURL;
CFBundleRef glxBundle;
// Get the main bundle for the application
mainBundle = CFBundleGetMainBundle();
// Choose the bundle to load
ErrorF("Loading GLX bundle ");
if (quartzUseAGL) {
bundleName = CFSTR("glxAGL.bundle");
ErrorF("glxAGL.bundle (using Apple's OpenGL)\n");
} else {
bundleName = CFSTR("glxMesa.bundle");
ErrorF("glxMesa.bundle (using Mesa)\n");
}
// Look for the appropriate GLX bundle in the main bundle by name
bundleURL = CFBundleCopyResourceURL(mainBundle, bundleName,
NULL, NULL);
if (!bundleURL) {
FatalError("Could not find GLX bundle.");
}
// Make a bundle instance using the URLRef
glxBundle = CFBundleCreate(kCFAllocatorDefault, bundleURL);
if (!CFBundleLoadExecutable(glxBundle)) {
FatalError("Could not load GLX bundle.");
}
// Find the GLX init functions
GlxExtensionInit = (void *) CFBundleGetFunctionPointerForName(
glxBundle, CFSTR("GlxExtensionInit"));
GlxWrapInitVisuals = (void *) CFBundleGetFunctionPointerForName(
glxBundle, CFSTR("GlxWrapInitVisuals"));
if (!GlxExtensionInit || !GlxWrapInitVisuals) {
FatalError("Could not initialize GLX bundle.");
}
// Release the CF objects
CFRelease(mainBundle);
CFRelease(bundleURL);
}
示例5: GetMissingQTFunctionPointers
static void GetMissingQTFunctionPointers()
{
OSErr err;
CFBundleRef sysBundle;
err = LoadFrameworkBundle(CFSTR("QuickTime.framework"), &sysBundle);
if (err == noErr)
{
mNewQTNextPtr = (NewQTNextTaskPtr) CFBundleGetFunctionPointerForName( sysBundle, CFSTR("NewQTNextTaskNeededSoonerCallbackUPP") );
mQTInstallNextPtr = (QTInstallNextTaskPtr) CFBundleGetFunctionPointerForName( sysBundle, CFSTR("QTInstallNextTaskNeededSoonerCallback") );
mQTGetTimeUntilNextTaskPtr = (QTGetTimeUntilNextTaskPtr) CFBundleGetFunctionPointerForName( sysBundle, CFSTR("QTGetTimeUntilNextTask") );
mDisposeQTNextTaskPtr = (DisposeQTNextTaskPtr)CFBundleGetFunctionPointerForName( sysBundle, CFSTR("DisposeQTNextTaskNeededSoonerCallbackUPP") );
mQTUninstallNextTaskPtr = (QTUninstallNextTaskPtr)CFBundleGetFunctionPointerForName( sysBundle, CFSTR("QTUninstallNextTaskNeededSoonerCallback") );;
}
}
示例6: readPListFile
static WTF::RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool createFile, CFBundleRef bundle)
{
if (createFile) {
BP_CreatePluginMIMETypesPreferencesFuncPtr funcPtr =
(BP_CreatePluginMIMETypesPreferencesFuncPtr)CFBundleGetFunctionPointerForName(bundle, CFSTR("BP_CreatePluginMIMETypesPreferences"));
if (funcPtr)
funcPtr();
}
WTF::RetainPtr<CFDictionaryRef> map;
WTF::RetainPtr<CFURLRef> url =
CFURLCreateWithFileSystemPath(kCFAllocatorDefault, fileName, kCFURLPOSIXPathStyle, false);
CFDataRef resource = 0;
SInt32 code;
if (!CFURLCreateDataAndPropertiesFromResource(kCFAllocatorDefault, url.get(), &resource, 0, 0, &code))
return map;
WTF::RetainPtr<CFPropertyListRef> propertyList =
CFPropertyListCreateFromXMLData(kCFAllocatorDefault, resource, kCFPropertyListImmutable, 0);
CFRelease(resource);
if (!propertyList)
return map;
if (CFGetTypeID(propertyList.get()) != CFDictionaryGetTypeID())
return map;
map = static_cast<CFDictionaryRef>(static_cast<CFPropertyListRef>(propertyList.get()));
return map;
}
示例7: CFStringCreateWithCString
void *mac_getBundleSym(CFBundleRef bundle, const char *name)
{
CFStringRef nameRef = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII);
void *sym = CFBundleGetFunctionPointerForName(bundle, nameRef);
CFRelease(nameRef);
return sym;
}
示例8: _CFBundlePlugInLoaded
__private_extern__ void _CFBundlePlugInLoaded(CFBundleRef bundle) {
CFDictionaryRef infoDict = CFBundleGetInfoDictionary(bundle);
CFStringRef tempStr;
CFPlugInDynamicRegisterFunction func = NULL;
if (!__CFBundleGetPlugInData(bundle)->_isPlugIn || __CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration || !infoDict || !CFBundleIsExecutableLoaded(bundle)) return;
tempStr = (CFStringRef)CFDictionaryGetValue(infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
if (tempStr && CFGetTypeID(tempStr) == CFStringGetTypeID() && CFStringCompare(tempStr, CFSTR("YES"), kCFCompareCaseInsensitive) == kCFCompareEqualTo) {
CFDictionaryRemoveValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
tempStr = (CFStringRef)CFDictionaryGetValue(infoDict, kCFPlugInDynamicRegisterFunctionKey);
if (!tempStr || CFGetTypeID(tempStr) != CFStringGetTypeID() || CFStringGetLength(tempStr) <= 0) tempStr = CFSTR("CFPlugInDynamicRegister");
__CFBundleGetPlugInData(bundle)->_loadOnDemand = false;
__CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = true;
/* Find the symbol and call it. */
func = (CFPlugInDynamicRegisterFunction)CFBundleGetFunctionPointerForName(bundle, tempStr);
if (func) {
func(bundle);
// MF:!!! Unload function is never called. Need to deal with this!
}
__CFBundleGetPlugInData(bundle)->_isDoingDynamicRegistration = false;
if (__CFBundleGetPlugInData(bundle)->_loadOnDemand && __CFBundleGetPlugInData(bundle)->_instanceCount == 0) CFBundleUnloadExecutable(bundle); // Unload now if we can/should.
} else {
CFDictionaryRemoveValue((CFMutableDictionaryRef)infoDict, CFSTR("CFPlugInNeedsDynamicRegistration"));
}
}
示例9: CFBundleGetBundleWithIdentifier
void HeadlessView::loadExtensions() {
if (extensionsLoaded) {
return;
}
#ifdef MBGL_USE_CGL
gl::InitializeExtensions([](const char * name) {
static CFBundleRef framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl"));
if (!framework) {
throw std::runtime_error("Failed to load OpenGL framework.");
}
CFStringRef str = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingASCII);
void* symbol = CFBundleGetFunctionPointerForName(framework, str);
CFRelease(str);
return reinterpret_cast<gl::glProc>(symbol);
});
#endif
#ifdef MBGL_USE_GLX
gl::InitializeExtensions([](const char * name) {
return glXGetProcAddress(reinterpret_cast<const GLubyte *>(name));
});
#endif
extensionsLoaded = true;
}
示例10: defined
//-----------------------------------------------------------------------------
void *DynamicLibrary::getProcAddress( const char *function )
{
OSErr err = noErr;
void *fnAddress = NULL;
#if defined(TORQUE_OS_MAC_CARB)
if (platState.osX)
{
CFStringRef str = CFStringCreateWithCString(NULL, function, kCFStringEncodingMacRoman);
fnAddress = CFBundleGetFunctionPointerForName( (CFBundleRef)hInst, str );
if (fnAddress == NULL)
err = cfragNoSymbolErr;
CFRelease(str);
}
else
#endif
{
err = FindSymbol((CFragConnectionID)hInst, str2p(function), (char**)&fnAddress, NULL);
}
if (!fnAddress) {
if (mErrorReport)
Con::errorf("DynamicLibrary: function '%s' not found!", function);
mError = true;
}
return fnAddress;
}
示例11: defined
void* OSCodeFragment::GetSymbol(const char* inSymbolName)
{
if (fFragmentP == NULL)
return NULL;
#if defined(HPUX) || defined(HPUX10)
void *symaddr = NULL;
int status;
errno = 0;
status = shl_findsym((shl_t *)&fFragmentP, symname, TYPE_PROCEDURE, &symaddr);
if (status == -1 && errno == 0) /* try TYPE_DATA instead */
status = shl_findsym((shl_t *)&fFragmentP, inSymbolName, TYPE_DATA, &symaddr);
return (status == -1 ? NULL : symaddr);
#elif defined(DLSYM_NEEDS_UNDERSCORE)
char *symbol = (char*)malloc(sizeof(char)*(strlen(inSymbolName)+2));
void *retval;
qtss_sprintf(symbol, "_%s", inSymbolName);
retval = dlsym(fFragmentP, symbol);
free(symbol);
return retval;
#elif defined(__Win32__)
return ::GetProcAddress(fFragmentP, inSymbolName);
#elif defined(__MacOSX__)
CFStringRef theString = CFStringCreateWithCString( kCFAllocatorDefault, inSymbolName, kCFStringEncodingASCII);
void* theSymbol = (void*)CFBundleGetFunctionPointerForName( fFragmentP, theString );
CFRelease(theString);
return theSymbol;
#else
return dlsym(fFragmentP, inSymbolName);
#endif
}
示例12: CFBundleGetFunctionPointersForNames
void CFBundleGetFunctionPointersForNames(CFBundleRef bundle, CFArrayRef functionNames, void *ftbl[]) {
SInt32 i, c;
if (!ftbl) return;
c = CFArrayGetCount(functionNames);
for (i = 0; i < c; i++) ftbl[i] = CFBundleGetFunctionPointerForName(bundle, (CFStringRef)CFArrayGetValueAtIndex(functionNames, i));
}
示例13: InitBMDStreamingAPI
void InitBMDStreamingAPI(void)
{
CFURLRef bundleURL;
bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kBMDStreamingAPI_BundlePath), kCFURLPOSIXPathStyle, true);
if (bundleURL != NULL)
{
gBMDStreamingAPIBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL);
if (gBMDStreamingAPIBundleRef != NULL)
{
gCreateDiscoveryFunc = (CreateDiscoveryFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingDiscoveryInstance_0002"));
gCreateNALParserFunc = (CreateNALParserFunc)CFBundleGetFunctionPointerForName(gBMDStreamingAPIBundleRef, CFSTR("CreateBMDStreamingH264NALParser_0001"));
}
CFRelease(bundleURL);
}
}
示例14: LoadRadioEffectComponent
static CFBundleRef LoadRadioEffectComponent()
{
bool bLoaded = false;
CFBundleRef Bundle = NULL;
CFBundleRef MainBundleRef = CFBundleGetMainBundle();
if( MainBundleRef )
{
CFURLRef ComponentURLRef = CFBundleCopyResourceURL( MainBundleRef, CFSTR("RadioEffectUnit"), CFSTR("component"), 0 );
if( ComponentURLRef )
{
Bundle = CFBundleCreate(kCFAllocatorDefault, ComponentURLRef);
if(Bundle)
{
CFArrayRef Components = (CFArrayRef)CFBundleGetValueForInfoDictionaryKey(Bundle, CFSTR("AudioComponents"));
if ( Components && CFArrayGetCount(Components) )
{
CFDictionaryRef ComponentInfo = (CFDictionaryRef)CFArrayGetValueAtIndex(Components, 0);
CFNumberRef ComponentVersion = (CFNumberRef)CFDictionaryGetValue(ComponentInfo, CFSTR("version"));
CFStringRef ComponentFactoryFunction = (CFStringRef)CFDictionaryGetValue(ComponentInfo, CFSTR("factoryFunction"));
if( ComponentVersion && ComponentFactoryFunction )
{
int32 Version = 0;
CFNumberGetValue(ComponentVersion, kCFNumberSInt32Type, &Version);
AudioComponentFactoryFunction Factory = (AudioComponentFactoryFunction)CFBundleGetFunctionPointerForName(Bundle, ComponentFactoryFunction);
if(Factory)
{
// fill out the AudioComponentDescription
AudioComponentDescription theDescription;
theDescription.componentType = kAudioUnitType_Effect;
theDescription.componentSubType = 'Rdio';
theDescription.componentManufacturer = 'Epic';
theDescription.componentFlagsMask = 0;
AudioComponent RadioComponent = AudioComponentFindNext(nullptr, &theDescription);
if ( !RadioComponent )
{
RadioComponent = AudioComponentRegister(&theDescription, CFSTR("Epic Games: RadioEffectUnit"), Version, Factory);
check(RadioComponent);
}
bLoaded = (RadioComponent != NULL);
}
}
}
if(!bLoaded)
{
CFRelease(Bundle);
Bundle = NULL;
}
}
CFRelease( ComponentURLRef );
}
}
return Bundle;
}
示例15: InitDeckLinkAPI_v7_6
void InitDeckLinkAPI_v7_6 (void)
{
CFURLRef bundleURL;
bundleURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, CFSTR(kDeckLinkAPI_BundlePath), kCFURLPOSIXPathStyle, true);
if (bundleURL != NULL)
{
gBundleRef = CFBundleCreate(kCFAllocatorDefault, bundleURL);
if (gBundleRef != NULL)
{
gCreateIteratorFunc = (CreateIteratorFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateDeckLinkIteratorInstance"));
gCreateOpenGLPreviewFunc = (CreateOpenGLScreenPreviewHelperFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateOpenGLScreenPreviewHelper"));
gCreateCocoaPreviewFunc = (CreateCocoaScreenPreviewFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateCocoaScreenPreview"));
gCreateVideoConversionFunc = (CreateVideoConversionInstanceFunc_v7_6)CFBundleGetFunctionPointerForName(gBundleRef, CFSTR("CreateVideoConversionInstance"));
}
CFRelease(bundleURL);
}
}