From 344d66a51bb1caa147e4fc14c9c97c2c2549ab0d Mon Sep 17 00:00:00 2001 From: das Date: Tue, 20 Jul 2004 05:37:43 +0000 Subject: * 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. --- ChangeLog | 6 ++++++ macosx/tclMacOSXBundle.c | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index e67637a..913521e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-07-20 Daniel Steffen + + * 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 Jeff Hobbs * unix/Makefile.in, unix/tcl.m4: move (C|LD)FLAGS after their 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 +#include #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, -- cgit v0.12