changeset 1790:828a17e05192

Date: Mon, 8 May 2006 14:19:30 -0700 From: Bob Ippolito Subject: SDL trunk (r2346) and Mac OS X The current state of the trunk doesn't quite compile on Mac OS X, I've attached a series of patches that gets it to compile and kills a few warnings. sdl-trunk-r2346-dlcompat-warnings.diff: The dlcompat thing is just loaded with incorrect type signatures .. some of them have changed since 10.2 and others are just flat wrong. This puts it in sync with the latest headers. People on 10.2 will get the warnings instead of people with new kits.
author Sam Lantinga <slouken@libsdl.org>
date Tue, 09 May 2006 07:26:58 +0000
parents 01313c1a2bbe
children 5652192b9c8b
files src/loadso/macosx/SDL_sysloadso.c
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/loadso/macosx/SDL_sysloadso.c	Tue May 09 07:20:32 2006 +0000
+++ b/src/loadso/macosx/SDL_sysloadso.c	Tue May 09 07:26:58 2006 +0000
@@ -94,6 +94,7 @@
 #define dl_restrict
 #endif
 
+#if 0
 #ifndef _POSIX_SOURCE
 /*
  * Structure filled in by dladdr().
@@ -107,6 +108,7 @@
 
 static int SDL_OSX_dladdr(const void * dl_restrict, SDL_OSX_Dl_info * dl_restrict);
 #endif /* ! _POSIX_SOURCE */
+#endif /* 0 */
 
 static int SDL_OSX_dlclose(void * handle);
 static const char * SDL_OSX_dlerror(void);
@@ -238,9 +240,9 @@
 static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError);
 static struct dlstatus *allocStatus(void);
 static struct dlstatus *loadModule(const char *path, const struct stat *sbuf, int mode);
-static NSSymbol *search_linked_libs(const struct mach_header *mh, const char *symbol);
+static NSSymbol search_linked_libs(const struct mach_header *mh, const char *symbol);
 static const char *get_lib_name(const struct mach_header *mh);
-static const struct mach_header *get_mach_header_from_NSModule(NSModule * mod);
+static const struct mach_header *get_mach_header_from_NSModule(NSModule mod);
 static void dlcompat_init_func(void);
 static inline void dlcompat_init_check(void);
 static inline void dolock(void);
@@ -331,10 +333,10 @@
  * and finding the one with the same name as the module. There really ought to be
  * an api for doing this, would be faster, but there isn't one right now
  */
-static const struct mach_header *get_mach_header_from_NSModule(NSModule * mod)
+static const struct mach_header *get_mach_header_from_NSModule(NSModule mod)
 {
 	const char *mod_name = NSNameOfModule(mod);
-	struct mach_header *mh = NULL;
+	const struct mach_header *mh = NULL;
 	unsigned long count = _dyld_image_count();
 	unsigned long i;
 	debug("Module name: %s", mod_name);
@@ -526,7 +528,7 @@
 	static int (*p) (NSModule module) = 0;
 	debug("promoting");
 	if (!p)
-		_dyld_func_lookup("__dyld_NSMakePrivateModulePublic", (unsigned long *)&p);
+		_dyld_func_lookup("__dyld_NSMakePrivateModulePublic", (void **)&p);
 	return (dls->module == MAGIC_DYLIB_MOD) || (p && p(dls->module));
 }
 
@@ -585,12 +587,12 @@
  * bother adding the extra dependencies, if the symbols are neither in the loaded image nor
  * any of it's direct dependencies, then it probably isn't there.
  */
-static NSSymbol *search_linked_libs(const struct mach_header * mh, const char *symbol)
+static NSSymbol search_linked_libs(const struct mach_header * mh, const char *symbol)
 {
 	unsigned int n;
 	struct load_command *lc = 0;
 	struct mach_header *wh;
-	NSSymbol *nssym = 0;
+	NSSymbol nssym = 0;
 	if (dyld_NSAddImage && dyld_NSIsSymbolNameDefinedInImage && dyld_NSLookupSymbolInImage)
 	{
 		lc = (struct load_command *)((char *)mh + sizeof(struct mach_header));
@@ -640,7 +642,7 @@
 
 static void *dlsymIntern(struct dlstatus *dls, const char *symbol, int canSetError)
 {
-  NSSymbol *nssym = 0;
+  NSSymbol nssym = 0;
 #ifdef __GCC__  
 	void *caller = __builtin_return_address(1);	/* Be *very* careful about inlining */
 #else
@@ -899,10 +901,10 @@
 
 static void dlcompat_init_func(void)
 {
-        _dyld_func_lookup("__dyld_NSAddImage", (unsigned long *)&dyld_NSAddImage);
+        _dyld_func_lookup("__dyld_NSAddImage", (void **)&dyld_NSAddImage);
 	_dyld_func_lookup("__dyld_NSIsSymbolNameDefinedInImage",
-			  (unsigned long *)&dyld_NSIsSymbolNameDefinedInImage);
-	_dyld_func_lookup("__dyld_NSLookupSymbolInImage", (unsigned long *)&dyld_NSLookupSymbolInImage);
+			  (void **)&dyld_NSIsSymbolNameDefinedInImage);
+	_dyld_func_lookup("__dyld_NSLookupSymbolInImage", (void **)&dyld_NSLookupSymbolInImage);
 	if (pthread_mutex_init(&dlcompat_mutex, NULL))
 	    exit(1);
 	if (pthread_key_create(&dlerror_key, &dlerrorfree))
@@ -1189,9 +1191,9 @@
 	unsigned long i;
 	unsigned long j;
 	unsigned long count = _dyld_image_count();
-	struct mach_header *mh = 0;
+	const struct mach_header *mh = 0;
 	struct load_command *lc = 0;
-	unsigned long addr = NULL;
+	unsigned long addr = 0;
 	for (i = 0; i < count; i++)
 	{
 		addr = (unsigned long)address - _dyld_get_image_vmaddr_slide(i);
@@ -1216,6 +1218,7 @@
 	return mh;
 }
 
+#if 0 /* unused */
 static int SDL_OSX_dladdr(const void * dl_restrict p, SDL_OSX_Dl_info * dl_restrict info)
 {
 /*
@@ -1323,7 +1326,7 @@
 	dounlock();
 	return 1;
 }
-
+#endif
 
 /*
  * Implement the dlfunc() interface, which behaves exactly the same as