diff options
author | das <das> | 2004-07-20 05:37:43 (GMT) |
---|---|---|
committer | das <das> | 2004-07-20 05:37:43 (GMT) |
commit | 344d66a51bb1caa147e4fc14c9c97c2c2549ab0d (patch) | |
tree | 9a6890bb7f0fefe80a83184bbd3b2eada01d5bc4 /macosx | |
parent | 34259c8123aa7777282ae8029f04aa8caea77e1c (diff) | |
download | tcl-344d66a51bb1caa147e4fc14c9c97c2c2549ab0d.zip tcl-344d66a51bb1caa147e4fc14c9c97c2c2549ab0d.tar.gz tcl-344d66a51bb1caa147e4fc14c9c97c2c2549ab0d.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.
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, |