diff options
author | das <das@noemail.net> | 2004-07-20 05:40:57 (GMT) |
---|---|---|
committer | das <das@noemail.net> | 2004-07-20 05:40:57 (GMT) |
commit | d5ae600a07d2eb05c247d9af0374c37590dd950e (patch) | |
tree | 766fd97a045cbf0a56e9a00c7d91158040179360 /macosx | |
parent | 3c213e12d8b445a02152833e8104f857c330af9d (diff) | |
download | tcl-d5ae600a07d2eb05c247d9af0374c37590dd950e.zip tcl-d5ae600a07d2eb05c247d9af0374c37590dd950e.tar.gz tcl-d5ae600a07d2eb05c247d9af0374c37590dd950e.tar.bz2 |
* macosx/tclMacOSXBundle.c: dynamically acquire address for
CFBundleOpenBundleResourceMap symbol, since it is only present in
full CoreFoundation on Mac OS X and not in CFLite on pure Darwin.
FossilOrigin-Name: c34d162c155d20c88e808e126c49decd15d9d9d5
Diffstat (limited to 'macosx')
-rw-r--r-- | macosx/tclMacOSXBundle.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/macosx/tclMacOSXBundle.c b/macosx/tclMacOSXBundle.c index 5018aa8..8d50494 100644 --- a/macosx/tclMacOSXBundle.c +++ b/macosx/tclMacOSXBundle.c @@ -52,6 +52,7 @@ */ #include <CoreFoundation/CoreFoundation.h> +#include <mach-o/dyld.h> #include "tcl.h" /* @@ -167,8 +168,25 @@ Tcl_MacOSXOpenVersionedBundleResources( if (bundleRef) { if (hasResourceFile) { - short refNum; - refNum = CFBundleOpenBundleResourceMap(bundleRef); + /* Dynamically acquire address for CFBundleOpenBundleResourceMap + * symbol, since it is only present in full CoreFoundation + * on Mac OS X and not in CFLite on pure Darwin. */ + static int initialized = FALSE; + static short (*openresourcemap)(CFBundleRef) = NULL; + if(!initialized) { + NSSymbol nsSymbol = NULL; + if(NSIsSymbolNameDefinedWithHint("_CFBundleOpenBundleResourceMap", "CoreFoundation")) { + nsSymbol = NSLookupAndBindSymbolWithHint("_CFBundleOpenBundleResourceMap", "CoreFoundation"); + if(nsSymbol) { + openresourcemap = NSAddressOfSymbol(nsSymbol); + } + } + initialized = TRUE; + } + if (openresourcemap) { + short refNum; + refNum = openresourcemap(bundleRef); + } } libURL = CFBundleCopyResourceURL(bundleRef, |