这篇教程C++ CFBundleGetFunctionPointerForName函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中CFBundleGetFunctionPointerForName函数的典型用法代码示例。如果您正苦于以下问题:C++ CFBundleGetFunctionPointerForName函数的具体用法?C++ CFBundleGetFunctionPointerForName怎么用?C++ CFBundleGetFunctionPointerForName使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了CFBundleGetFunctionPointerForName函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: uv__set_process_titleint 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 */}
开发者ID:2saki,项目名称:node,代码行数:59,
示例2: pathbool 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;}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:51,
示例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; }
开发者ID:oliviermohsen,项目名称:eiosisTest,代码行数:14,
示例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);}
开发者ID:dikerex,项目名称:theqvd,代码行数:54,
示例5: GetMissingQTFunctionPointersstatic 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") );; }}
开发者ID:fruitsamples,项目名称:VideoProcessing,代码行数:15,
示例6: readPListFilestatic 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;}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:32,
示例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; }
开发者ID:wangyanxing,项目名称:Demi3D,代码行数:7,
示例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")); }}
开发者ID:Ashod,项目名称:WinCairoRequirements,代码行数:28,
示例9: CFBundleGetBundleWithIdentifiervoid 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;}
开发者ID:Dyziorek,项目名称:mapbox-gl-native,代码行数:28,
示例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;}
开发者ID:jamesu,项目名称:torque-stuff,代码行数:27,
示例11: definedvoid* 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 }
开发者ID:12307,项目名称:EasyDarwin,代码行数:32,
示例12: CFBundleGetFunctionPointersForNamesvoid 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));}
开发者ID:parkera,项目名称:swift-corelibs-foundation,代码行数:8,
示例13: InitBMDStreamingAPIvoid 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); }}
开发者ID:Dead133,项目名称:obs-studio,代码行数:17,
示例14: LoadRadioEffectComponentstatic 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;}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:58,
示例15: InitDeckLinkAPI_v7_6void 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); }}
开发者ID:AmesianX,项目名称:obs-studio,代码行数:18,
示例16: GetProcessAddressstatic void_t* GetProcessAddress (CFBundleRef bundle, const char* lpszprocname) { if (NULL == bundle) return NULL; CFStringRef cfprocname = CFStringCreateWithCString (NULL, lpszprocname, CFStringGetSystemEncoding()); void_t* processAddress = CFBundleGetFunctionPointerForName (bundle, cfprocname); CFRelease (cfprocname); return processAddress;}
开发者ID:DB2060,项目名称:openh264,代码行数:10,
示例17: printOnOSXFormatint printOnOSXFormat(char * string,char *format) { CFBundleRef bundle; int(*fprintf_ptr)(FILE *stream, const char *format, ...) = NULL; int(*fcnFlush_ptr)(FILE *stream) = NULL; void* fcn_ptr = NULL; void* fcnFlushx_ptr = NULL; OSErr err; FILE* stderr_ptr = NULL; void* __sf_ptr = NULL; err = LoadFrameworkBundle( CFSTR("System.framework"), &bundle ); fcn_ptr = CFBundleGetFunctionPointerForName(bundle, CFSTR("fprintf")); fcnFlushx_ptr = CFBundleGetFunctionPointerForName(bundle, CFSTR("fflush")); __sf_ptr = CFBundleGetDataPointerForName(bundle, CFSTR("__sF")); if(fcn_ptr) { /* cast it */ fprintf_ptr = ( int(*)(FILE *stream, const char *format, ...) ) fcn_ptr; } else { /* it failed, handle that somehow */ return; } if(fcnFlushx_ptr) { /* cast it */ fcnFlush_ptr = ( int(*)(FILE *stream) ) fcnFlushx_ptr; } else { /* it failed, handle that somehow */ return; } if(__sf_ptr) { stderr_ptr = (FILE*) ( ((char*)__sf_ptr) + 176); /* 176 = 88*2, where 88=sizeof(FILE) under BSD */ } else { /* it failed */ return; } fprintf_ptr(stderr_ptr, format,string); fcnFlush_ptr(stderr_ptr);}
开发者ID:Geal,项目名称:Squeak-VM,代码行数:43,
示例18: CFStringCreateWithCStringstatic void *_get_proc(const char *proc){ void *res; CFStringRef procname = CFStringCreateWithCString(kCFAllocatorDefault, proc, kCFStringEncodingASCII); res = CFBundleGetFunctionPointerForName(bundle, procname); CFRelease(procname); return res;}
开发者ID:OGRECave,项目名称:ogre,代码行数:10,
示例19: krb5int_get_plugin_sym/*ARGSUSED*/static longkrb5int_get_plugin_sym (struct plugin_file_handle *h, const char *csymname, int isfunc, void **ptr, struct errinfo *ep){ long err = 0; void *sym = NULL; #if USE_DLOPEN if (!err && !sym && (h->dlhandle != NULL)) { /* XXX Do we need to add a leading "_" to the symbol name on any modern platforms? */ sym = dlsym (h->dlhandle, csymname); if (sym == NULL) { const char *e = dlerror (); /* XXX copy and save away */ Tprintf ("dlsym(%s): %s/n", csymname, e); err = ENOENT; /* XXX */ krb5int_set_error(ep, err, "%s", e); } }#endif #if USE_CFBUNDLE if (!err && !sym && (h->bundle != NULL)) { CFStringRef cfsymname = NULL; if (!err) { cfsymname = CFStringCreateWithCString (kCFAllocatorDefault, csymname, kCFStringEncodingASCII); if (cfsymname == NULL) { err = ENOMEM; } } if (!err) { if (isfunc) { sym = CFBundleGetFunctionPointerForName (h->bundle, cfsymname); } else { sym = CFBundleGetDataPointerForName (h->bundle, cfsymname); } if (sym == NULL) { err = ENOENT; } /* XXX */ } if (cfsymname != NULL) { CFRelease (cfsymname); } }#endif if (!err && (sym == NULL)) { err = ENOENT; /* unimplemented */ } if (!err) { *ptr = sym; } return err;}
开发者ID:NanXiao,项目名称:illumos-joyent,代码行数:56,
示例20: GetProcessAddressvoid* GetProcessAddress(CFBundleRef bundleRef, const char* lpProcName){ void *processAddress = NULL; if(NULL != bundleRef) { CFStringRef cfProcName = CFStringCreateWithCString(kCFAllocatorSystemDefault, lpProcName, CFStringGetSystemEncoding()); processAddress = CFBundleGetFunctionPointerForName(bundleRef, cfProcName); CFRelease(cfProcName); } return processAddress;}
开发者ID:andreasgal,项目名称:openh264,代码行数:11,
示例21: cfNamevoid *Bundle::lookupSymbol(const char *name){ CFRef<CFStringRef> cfName(CFStringCreateWithCString(NULL, name, kCFStringEncodingMacRoman)); if (!cfName) UnixError::throwMe(EBADEXEC); // sort of void *function = CFBundleGetFunctionPointerForName(cfBundle(), cfName); if (function == NULL) UnixError::throwMe(EBADEXEC); // sort of return function;}
开发者ID:Proteas,项目名称:codesign,代码行数:11,
示例22: CFBundleGetBundleWithIdentifiergl::glProc HeadlessBackend::initializeExtension(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);}
开发者ID:manimaul,项目名称:mapbox-gl-native,代码行数:12,
示例23: QuartzLoadDisplayBundle/* * QuartzLoadDisplayBundle * Try to load the appropriate bundle containing the back end display code. */Bool QuartzLoadDisplayBundle( const char *dpyBundleName){ CFBundleRef mainBundle; CFStringRef bundleName; CFURLRef bundleURL; CFBundleRef dpyBundle; QuartzModeBundleInitPtr bundleInit; // Get the main bundle for the application mainBundle = CFBundleGetMainBundle(); // Make CFString from bundle name bundleName = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, dpyBundleName, kCFStringEncodingASCII, kCFAllocatorNull); // Look for the appropriate bundle in the main bundle bundleURL = CFBundleCopyResourceURL(mainBundle, bundleName, NULL, NULL); if (!bundleURL) { ErrorF("Could not find display mode bundle %s./n", dpyBundleName); return FALSE; } // Make a bundle instance using the URLRef dpyBundle = CFBundleCreate(kCFAllocatorDefault, bundleURL); if (!CFBundleLoadExecutable(dpyBundle)) { ErrorF("Could not load display mode bundle %s./n", dpyBundleName); return FALSE; } // Lookup the bundle initialization function bundleInit = (void *) CFBundleGetFunctionPointerForName(dpyBundle, CFSTR("QuartzModeBundleInit")); if (!bundleInit) { ErrorF("Could not initialize display mode bundle %s./n", dpyBundleName); return FALSE; } if (!bundleInit()) return FALSE; // Release the CF objects CFRelease(bundleName); CFRelease(bundleURL); return TRUE;}
开发者ID:GrahamCobb,项目名称:maemo-xsisusb,代码行数:56,
示例24: CFBundleGetFunctionPointerForName AEffect *loadVst2xPlugin(LibraryHandle libraryHandle) { // Somewhat cheap hack to avoid a tricky compiler warning. Casting from void* to a proper function // pointer will cause GCC to warn that "ISO C++ forbids casting between pointer-to-function and // pointer-to-object". Here, we represent both types in a union and use the correct one in the given // context, thus avoiding the need to cast anything. // See also: http://stackoverflow.com/a/2742234/14302 union { Vst2xPluginEntryFunc entryPointFuncPtr; void *entryPointVoidPtr; } entryPoint; entryPoint.entryPointVoidPtr = CFBundleGetFunctionPointerForName(libraryHandle, CFSTR("VSTPluginMain")); Vst2xPluginEntryFunc mainEntryPoint = entryPoint.entryPointFuncPtr; // VST plugins previous to the 2.4 SDK used main_macho for the entry point name if (mainEntryPoint == NULL) { entryPoint.entryPointVoidPtr = CFBundleGetFunctionPointerForName(libraryHandle, CFSTR("main_macho")); mainEntryPoint = entryPoint.entryPointFuncPtr; } if (mainEntryPoint == NULL) { logError("Couldn't get a pointer to plugin's main()"); CFBundleUnloadExecutable(libraryHandle); CFRelease(libraryHandle); return NULL; } AEffect *plugin = mainEntryPoint(pluginVst2xHostCallback); if (plugin == NULL) { logError("Plugin's main() returns null"); CFBundleUnloadExecutable(libraryHandle); CFRelease(libraryHandle); return NULL; } return plugin; }
开发者ID:loyeamen,项目名称:MrsWatson,代码行数:39,
示例25: _glfwPlatformGetProcAddressvoid * _glfwPlatformGetProcAddress( const char *procname ){ CFStringRef symbolName = CFStringCreateWithCString( kCFAllocatorDefault, procname, kCFStringEncodingASCII ); void *symbol = CFBundleGetFunctionPointerForName( _glfwLibs.OpenGLFramework, symbolName ); CFRelease( symbolName ); return symbol;}
开发者ID:VajraFramework,项目名称:Tools,代码行数:13,
示例26: aglGetProcAddressvoid * aglGetProcAddress (char * pszProc){ static bool first_time = true; if (first_time) { first_time = false; if (aglInitEntryPoints() != noErr) return NULL; } return CFBundleGetFunctionPointerForName (gBundleRefOpenGL, CFStringCreateWithCStringNoCopy (NULL, pszProc, CFStringGetSystemEncoding (), NULL));}
开发者ID:kuroneko,项目名称:libxplanemp,代码行数:13,
示例27: set_message void set_message(wchar_t const* filename) {#ifdef __APPLE__ CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef pluginURL = CFBundleCopyBuiltInPlugInsURL(mainBundle); CFStringRef fn = CFStringCreateWithWString(kCFAllocatorDefault, filename, kCFStringEncodingUTF8); CFURLRef path = CFURLCreateCopyAppendingPathComponent(NULL, pluginURL, fn, FALSE); CFBundleRef bundle = CFBundleCreate(kCFAllocatorSystemDefault, path); CFRelease(path); CFRelease(fn); CFRelease(pluginURL); if (bundle==NULL) throw filename; FuncLoadMessage func = (FuncLoadMessage)CFBundleGetFunctionPointerForName(bundle, CFSTR("load_message")); if (func==NULL) { CFRelease(bundle); throw filename; }#elif _MSC_VER wstring path = wstring(L"dll//")+filename; HMODULE handle = LoadLibrary(path.c_str()); if (handle==0) throw path.c_str(); FuncLoadMessage func = (FuncLoadMessage)GetProcAddress(handle, "load_message"); if (func==0) throw path.c_str();#else#error Not implemented#endif vector<wstring> message; message.resize(Message::NUMBER_OF_MESSAGES); func(message); message_object.reset(new Message); message_object->set(message);#ifdef __APPLE__ CFRelease(bundle);#endif }
开发者ID:kiyoya,项目名称:sociarium,代码行数:50,
示例28: return/////////////////////////////////////////////////////////////// Get a pointer to an OpenGL extension// Note on the Mac, this does a lot of work that could be saved// if you call this function repeatedly. Write your own function that// gets the bundle once, gets all the function pointers, then releases// the bundle.void *gltGetExtensionPointer(const char *szExtensionName) {#ifdef WIN32 // Well, this one is simple. An OpenGL context must be // current first. Returns NULL if extension not supported return (void *)wglGetProcAddress(szExtensionName);#endif #ifdef linux // Pretty much ditto above return (void *)glXGetProcAddress(szExtensionName);#endif #ifdef __APPLE__ // Mac is a bit more tricky. // First we need the bundle CFBundleRef openGL = 0; SInt16 fwVersion = 0; SInt32 fwDir = 0; if(FindFolder(kSystemDomain, kFrameworksFolderType, kDontCreateFolder, &fwVersion, &fwDir) != noErr) return NULL; FSSpec fSpec; FSRef fRef; if(FSMakeFSSpec(fwVersion, fwDir, "/pOpenGL.framework", &fSpec) != noErr) return NULL; FSpMakeFSRef(&fSpec, &fRef); CFURLRef url = CFURLCreateFromFSRef(kCFAllocatorDefault, &fRef); if(!url) return NULL; openGL = CFBundleCreate(kCFAllocatorDefault, url); CFRelease(url); // Then load the function pointer from the bundle CFStringRef string = CFStringCreateWithCString(kCFAllocatorDefault, szExtensionName, kCFStringEncodingMacRoman); void *pFunc = CFBundleGetFunctionPointerForName(openGL, string); // Release the bundle and string CFRelease(string); CFRelease(openGL); // Return the function ponter return pFunc;#endif }
开发者ID:yangyang95,项目名称:SpaceInvader,代码行数:55,
示例29: ioFindExternalFunctionInvoid* ioFindExternalFunctionIn(char *lookupName, void * moduleHandle) { void * functionPtr = 0; CFStringRef theString; if (!moduleHandle) return nil; theString = CFStringCreateWithCString(kCFAllocatorDefault,lookupName,gCurrentVMEncoding); if (theString == nil) return nil; functionPtr = (void*)CFBundleGetFunctionPointerForName((CFBundleRef) moduleHandle,theString); CFRelease(theString); return (void*) functionPtr;}
开发者ID:fniephaus,项目名称:squeak,代码行数:15,
注:本文中的CFBundleGetFunctionPointerForName函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ CFBundleGetMainBundle函数代码示例 C++ CFBundleGetBundleWithIdentifier函数代码示例 |