summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXInit.c
diff options
context:
space:
mode:
Diffstat (limited to 'macosx/tkMacOSXInit.c')
-rw-r--r--macosx/tkMacOSXInit.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c
index 780bcc3..b604317 100644
--- a/macosx/tkMacOSXInit.c
+++ b/macosx/tkMacOSXInit.c
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXInit.c,v 1.11 2005/05/24 02:32:15 das Exp $
+ * RCS: @(#) $Id: tkMacOSXInit.c,v 1.12 2005/05/26 11:19:01 das Exp $
*/
#include "tkInt.h"
@@ -175,23 +175,20 @@ TkpInit(interp)
unsigned long size;
int fd = -1;
char fileName[L_tmpnam + 15];
+ int i, n;
/* Get resource data from __tk_rsrc section of tk library file */
-#ifdef HAVE__DYLD_GET_IMAGE_HEADER_CONTAINING_ADDRESS
- image = _dyld_get_image_header_containing_address((unsigned long)&TkpInit);
- if (image) {
- data = getsectdatafromheader(image, SEG_TEXT, "__tk_rsrc", &size);
- }
-#else
- int i, n = _dyld_image_count();
+ n = _dyld_image_count();
for (i = 0; i < n; i++) {
image = _dyld_get_image_header(i);
if (image) {
data = getsectdatafromheader(image, SEG_TEXT, "__tk_rsrc", &size);
+ if (data) {
+ data += _dyld_get_image_vmaddr_slide(i);
+ break;
+ }
}
- if (data) break;
}
-#endif
while (data) {
OSStatus err;
FSRef ref;
@@ -210,6 +207,7 @@ TkpInit(interp)
err = FSPathMakeRef(fileName, &ref, NULL);
if (err != noErr) break;
err = FSOpenResourceFile(&ref, 0, NULL, fsRdPerm, &refNum);
+ if (err != noErr) fprintf(stderr,"FSOpenResourceFile error %d\n",err);
break;
}
if (fd != -1) {