diff options
author | das <das> | 2004-07-20 05:40:57 (GMT) |
---|---|---|
committer | das <das> | 2004-07-20 05:40:57 (GMT) |
commit | 281500f39ea00f49bce3fd08e71e69b440482c21 (patch) | |
tree | 766fd97a045cbf0a56e9a00c7d91158040179360 | |
parent | afaa17239f992c094f9d5c07a7ada3c58e205993 (diff) | |
download | tcl-281500f39ea00f49bce3fd08e71e69b440482c21.zip tcl-281500f39ea00f49bce3fd08e71e69b440482c21.tar.gz tcl-281500f39ea00f49bce3fd08e71e69b440482c21.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.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | macosx/tclMacOSXBundle.c | 22 |
2 files changed, 26 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2004-07-20 Daniel Steffen <das@users.sourceforge.net> + + * 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. + 2004-07-19 Zoran Vasiljevic <vasiljevic@users.sf.net> * win/tclwinThrd.c: redefined MASTER_LOCK to call 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, |