Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CFBundleGetFunctionPointerForName returns NULL



As requested, here is the code that is failing:

MakeString takes a CFStringRef and returns a std::string used for logging
GetUrlPath takes a CFURLRef and returns a std::string used for logging

CFURLRef bundleUrl =
CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault, appURL,
m_bundles[loop].m_bundleName, true);
ASSERT(bundleUrl);
m_bundles[loop].m_bundle = CFBundleCreate(kCFAllocatorDefault, bundleUrl);
ASSERT(m_bundles[loop].m_bundle);
CFURLRef checkURL = CFBundleCopyBundleURL(m_bundles[loop].m_bundle);
TRACE("checkURL=%s\n", GetUrlPath(checkURL).c_str());
if (m_bundles[loop].m_functionNames)
{
    for (size_t func = 0; m_bundles[loop].m_functionNames[func]; func++)
    {
        TRACE("Loading function %s\n",
MakeString(m_bundles[loop].m_functionNames[func]).c_str());
        void* ptr =
CFBundleGetFunctionPointerForName(m_bundles[loop].m_bundle,
m_bundles[loop].m_functionNames[func]);
        ASSERT(ptr);
        if (ptr)
        {
            
m_functionMap.insert(FunctionMap::value_type(m_bundles[loop].m_functionNames
[func], ptr));
        }
    }
}
CFRelease(bundleUrl);

And here are some of the function names

CFStringRef AssignFontTable = CFSTR("_AssignFontTable");
CFStringRef GetSuperset = CFSTR("_GetSuperset");
CFStringRef StoreSuperset = CFSTR("_StoreSuperset");
CFStringRef DecryptSuperset = CFSTR("_DecryptSuperset");
CFStringRef EncryptSuperset = CFSTR("_EncryptSuperset");


On 11/28/07 1:57 AM, "Kevin Grant" <email@hidden> wrote:

> A few lines of sample code may help us more.
> 
> What bundle ref. are you providing when you ask for the function?
> What symbol are you trying to load, and what name is used to load it?
> What does the structure of the bundle look like?  (The code has to be
> in the right place in the bundle in order to be loaded.)
> 
> Kevin G.
> 
> 
> 
>> I'm having problems figuring out whats wrong in my application.
>> When I call
>> CFBundleGetFunctionPointerForName it always returns NULL.  I've
>> validated
>> that everything is universal binaries.  I used the names that I
>> retrieved
>> from otool, but it still returns NULL.  All of the functions that
>> I'm trying
>> to load are declared as extern "C".  The bundle is loading correctly
>> and I'm
>> not getting any errors.
>> 
>> Anyone have any ideas of what to look at next?


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: CFBundleGetFunctionPointerForName returns NULL (From: Kevin Grant <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.