mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Minor symbol visibility cleanups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23952 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4fa4c00318
commit
d733696a80
11 changed files with 168 additions and 253 deletions
11
ChangeLog
11
ChangeLog
|
@ -2,6 +2,17 @@
|
|||
|
||||
* Source/NSCalendarDate: when adding offset to a date, work in
|
||||
the timezone for the date rather than in GMT ... fixes bug #18088
|
||||
* Source/NSBundle.m:
|
||||
* Source/NSPathUtilities.m:
|
||||
* Source/NSProcessInfo.m:
|
||||
* Source/preface.m:
|
||||
* Source/NSCallBacks.h:
|
||||
* Source/GSPrivate.h:
|
||||
* Source/NSFileManager.m:
|
||||
* Source/objc-load.h:
|
||||
* Source/objc-load.m:
|
||||
* Headers/Additions/GNUstepBase/preface.h.in:
|
||||
More cleanups hiding private functions and removing a few unused bits.
|
||||
|
||||
2006-10-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -98,14 +98,6 @@
|
|||
#define GNUSTEP_BASE_SUBMINOR_VERSION @SUBMINOR_VERSION@
|
||||
#define GNUSTEP_BASE_GCC_VERSION @GCC_VERSION@
|
||||
|
||||
#if 0
|
||||
extern const char o_version[];
|
||||
extern const char o_gcc_version[];
|
||||
#if NeXT_cc
|
||||
extern const char o_NeXT_cc_version[];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define OBJC_MALLOC(VAR, TYPE, NUM) \
|
||||
((VAR) = (TYPE *) objc_malloc ((unsigned)(NUM)*sizeof(TYPE)))
|
||||
#define OBJC_VALLOC(VAR, TYPE, NUM) \
|
||||
|
|
|
@ -263,6 +263,11 @@ GSPrivateEncodingName(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
|
|||
BOOL
|
||||
GSPrivateEnvironmentFlag(const char *name, BOOL def) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* Get the path to the xcurrent executable.
|
||||
*/
|
||||
NSString *
|
||||
GSPrivateExecutablePath(void) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* Format arguments into an internal string.
|
||||
*/
|
||||
void
|
||||
|
@ -280,6 +285,13 @@ GSPrivateIsByteEncoding(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
|
|||
BOOL
|
||||
GSPrivateIsEncodingSupported(NSStringEncoding encoding) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* load a module into the runtime
|
||||
*/
|
||||
long
|
||||
GSPrivateLoadModule(NSString *filename, FILE *errorStream,
|
||||
void (*loadCallback)(Class, struct objc_category *),
|
||||
void **header, NSString *debugFilename) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* Function used by the NSRunLoop and friends for processing
|
||||
* queued notifications which should be processed at the first safe moment.
|
||||
*/
|
||||
|
@ -307,5 +319,58 @@ GSPrivateStrAppendUnichars(GSStr s, const unichar *u, unsigned l)
|
|||
void
|
||||
GSPrivateStrExternalize(GSStr s) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/*
|
||||
* GSPrivateSymbolPath() returns the path to the object file from
|
||||
* which a certain class was loaded.
|
||||
*
|
||||
* If the class was loaded from a shared library, this returns the
|
||||
* filesystem path to the shared library; if it was loaded from a
|
||||
* dynamical object (such as a bundle or framework dynamically
|
||||
* loaded), it returns the filesystem path to the object file; if the
|
||||
* class was loaded from the main executable, it returns the
|
||||
* filesystem path to the main executable path.
|
||||
*
|
||||
* This function is implemented by using the available features of
|
||||
* the dynamic linker on the specific platform we are running on.
|
||||
*
|
||||
* On some platforms, the dynamic linker does not provide enough
|
||||
* facilities to support the GSPrivateSymbolPath() function at all;
|
||||
* in this case, GSPrivateSymbolPath() always returns nil.
|
||||
*
|
||||
* On my platform (a Debian GNU Linux), it seems the dynamic linker
|
||||
* always returns the filesystem path that was used to load the
|
||||
* module. So it returns the full filesystem path for shared libraries
|
||||
* and bundles (which is very nice), but unfortunately it returns
|
||||
* argv[0] (which might be something as horrible as './obj/test')
|
||||
* for classes in the main executable.
|
||||
*
|
||||
* If theCategory argument is not NULL, GSPrivateSymbolPath() will return
|
||||
* the filesystem path to the module from which the category theCategory
|
||||
* of the class theClass was loaded.
|
||||
*
|
||||
* Currently, the function will return nil if any of the following
|
||||
* conditions is satisfied:
|
||||
* - the required functionality is not available on the platform we are
|
||||
* running on;
|
||||
* - memory allocation fails;
|
||||
* - the symbol for that class/category could not be found.
|
||||
*
|
||||
* In general, if the function returns nil, it means something serious
|
||||
* went wrong in the system preventing it from getting the symbol path.
|
||||
* If your code is to be portable, you (unfortunately) have to be prepared
|
||||
* to work around it in some way when this happens.
|
||||
*
|
||||
* It seems that this function has no corresponding function in the NeXT
|
||||
* runtime ... as far as I know.
|
||||
*/
|
||||
NSString *
|
||||
GSPrivateSymbolPath (Class theClass, Category *theCategory) GS_ATTRIB_PRIVATE;
|
||||
|
||||
/* unload a module from the runtime (not implemented)
|
||||
*/
|
||||
long
|
||||
GSPrivateUnloadModule(FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *)) GS_ATTRIB_PRIVATE;
|
||||
|
||||
#endif /* _GSPrivate_h_ */
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@
|
|||
#include "Foundation/NSData.h"
|
||||
#include "Foundation/NSValue.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
@ -84,7 +86,7 @@ static NSString *_launchDirectory = nil;
|
|||
*/
|
||||
static NSDictionary *_emptyTable = nil;
|
||||
|
||||
/* When we are linking in an object file, objc_load_modules calls our
|
||||
/* When we are linking in an object file, GSPrivateLoadModule calls our
|
||||
callback routine for every Class and Category loaded. The following
|
||||
variable stores the bundle that is currently doing the loading so we know
|
||||
where to store the class names.
|
||||
|
@ -214,7 +216,8 @@ AbsolutePathOfExecutable(NSString *path, BOOL atLaunch)
|
|||
/*
|
||||
* Return the path to this executable.
|
||||
*/
|
||||
static NSString *ExecutablePath()
|
||||
NSString *
|
||||
GSPrivateExecutablePath()
|
||||
{
|
||||
static NSString *executablePath = nil;
|
||||
static BOOL beenHere = NO;
|
||||
|
@ -258,24 +261,6 @@ static NSString *ExecutablePath()
|
|||
return executablePath;
|
||||
}
|
||||
|
||||
/* This function is provided for objc-load.c, although I'm not sure it
|
||||
really needs it (So far only needed if using GNU dld library) */
|
||||
#ifdef __MINGW32__
|
||||
const unichar *
|
||||
objc_executable_location (void)
|
||||
{
|
||||
return [[ExecutablePath() stringByDeletingLastPathComponent]
|
||||
fileSystemRepresentation];
|
||||
}
|
||||
#else
|
||||
const char *
|
||||
objc_executable_location (void)
|
||||
{
|
||||
return [[ExecutablePath() stringByDeletingLastPathComponent]
|
||||
fileSystemRepresentation];
|
||||
}
|
||||
#endif
|
||||
|
||||
static BOOL
|
||||
bundle_directory_readable(NSString *path)
|
||||
{
|
||||
|
@ -499,9 +484,9 @@ _find_framework(NSString *name)
|
|||
* really universal way of getting the framework path ... we can
|
||||
* locate the framework no matter where it is on disk!
|
||||
*/
|
||||
bundlePath = objc_get_symbol_path (frameworkClass, NULL);
|
||||
bundlePath = GSPrivateSymbolPath (frameworkClass, NULL);
|
||||
|
||||
if ([bundlePath isEqualToString: ExecutablePath()])
|
||||
if ([bundlePath isEqualToString: GSPrivateExecutablePath()])
|
||||
{
|
||||
/* Ops ... the NSFramework_xxx class is linked in the main
|
||||
* executable. Maybe the framework was statically linked
|
||||
|
@ -585,8 +570,8 @@ _find_framework(NSString *name)
|
|||
if (bundlePath == nil)
|
||||
{
|
||||
/* NICOLA: In an ideal world, the following is just a hack
|
||||
* for when objc_get_symbol_path() fails! But in real life
|
||||
* objc_get_symbol_path() is risky (some platforms don't
|
||||
* for when GSPrivateSymbolPath() fails! But in real life
|
||||
* GSPrivateSymbolPath() is risky (some platforms don't
|
||||
* have it at all!), so this hack might be used a lot! It
|
||||
* must be quite robust. We try to look for the framework
|
||||
* in the standard GNUstep installation dirs and in the main
|
||||
|
@ -938,13 +923,13 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
know yet if it's a tool or an application, we always store
|
||||
the executable name here - just in case it turns out it's a
|
||||
tool. */
|
||||
NSString *toolName = [ExecutablePath() lastPathComponent];
|
||||
NSString *toolName = [GSPrivateExecutablePath() lastPathComponent];
|
||||
#if defined(__WIN32__) || defined(__CYGWIN__)
|
||||
toolName = [toolName stringByDeletingPathExtension];
|
||||
#endif
|
||||
|
||||
/* Strip off the name of the program */
|
||||
path = [ExecutablePath() stringByDeletingLastPathComponent];
|
||||
path = [GSPrivateExecutablePath() stringByDeletingLastPathComponent];
|
||||
|
||||
/* We now need to chop off the extra subdirectories, the library
|
||||
combo and the target cpu/os if they exist. The executable
|
||||
|
@ -1061,8 +1046,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
* convert it to the format for a library name as used
|
||||
* for obtaining a library resource bundle.
|
||||
*/
|
||||
lib = objc_get_symbol_path (aClass, NULL);
|
||||
if ([lib isEqual: ExecutablePath()] == YES)
|
||||
lib = GSPrivateSymbolPath (aClass, NULL);
|
||||
if ([lib isEqual: GSPrivateExecutablePath()] == YES)
|
||||
{
|
||||
lib = nil; // In program, not library.
|
||||
}
|
||||
|
@ -1396,8 +1381,7 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
_codeLoaded before loading the bundle. */
|
||||
_codeLoaded = YES;
|
||||
|
||||
if (objc_load_module([object fileSystemRepresentation],
|
||||
stderr, _bundle_load_callback, NULL, NULL))
|
||||
if (GSPrivateLoadModule(object, stderr, _bundle_load_callback, 0, 0))
|
||||
{
|
||||
_codeLoaded = NO;
|
||||
DESTROY(_loadingFrameworks);
|
||||
|
@ -1971,11 +1955,11 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
|
|||
}
|
||||
if (self == _mainBundle)
|
||||
{
|
||||
return ExecutablePath();
|
||||
return GSPrivateExecutablePath();
|
||||
}
|
||||
if (self->_bundleType == NSBUNDLE_LIBRARY)
|
||||
{
|
||||
return objc_get_symbol_path ([self principalClass], NULL);
|
||||
return GSPrivateSymbolPath ([self principalClass], NULL);
|
||||
}
|
||||
object = [[self infoDictionary] objectForKey: @"NSExecutable"];
|
||||
if (object == nil || [object length] == 0)
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the Free
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. */
|
||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02111 USA. */
|
||||
|
||||
#ifndef __NSCallBacks_h_OBJECTS_INCLUDE
|
||||
#define __NSCallBacks_h_OBJECTS_INCLUDE 1
|
||||
|
@ -31,53 +32,62 @@
|
|||
#include "Foundation/NSObject.h"
|
||||
#include "Foundation/NSString.h"
|
||||
|
||||
#if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3))
|
||||
#define GS_HIDDEN __attribute__ ((visibility("hidden")))
|
||||
#else
|
||||
#define GS_HIDDEN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/**** Type, Constant, and Macro Definitions **********************************/
|
||||
|
||||
/**** Function Prototypes ****************************************************/
|
||||
|
||||
/** For `int's **/
|
||||
|
||||
unsigned int _NS_int_hash(void *table, void* i);
|
||||
BOOL _NS_int_is_equal(void *table, void* i, void* j);
|
||||
void _NS_int_retain(void *table, void* i);
|
||||
void _NS_int_release(void *table, void* i);
|
||||
NSString *_NS_int_describe(void *table, void* i);
|
||||
unsigned int _NS_int_hash(void *table, void* i) GS_HIDDEN;
|
||||
BOOL _NS_int_is_equal(void *table, void* i, void* j) GS_HIDDEN;
|
||||
void _NS_int_retain(void *table, void* i) GS_HIDDEN;
|
||||
void _NS_int_release(void *table, void* i) GS_HIDDEN;
|
||||
NSString *_NS_int_describe(void *table, void* i) GS_HIDDEN;
|
||||
|
||||
/** For owned `void *' **/
|
||||
|
||||
unsigned int _NS_owned_void_p_hash(void *table, void *p);
|
||||
BOOL _NS_owned_void_p_is_equal(void *table, void *p, void *q);
|
||||
void _NS_owned_void_p_retain(void *table, void *p);
|
||||
void _NS_owned_void_p_release(void *table, void *p);
|
||||
NSString *_NS_owned_void_p_describe(void *table, void *p);
|
||||
unsigned int _NS_owned_void_p_hash(void *table, void *p) GS_HIDDEN;
|
||||
BOOL _NS_owned_void_p_is_equal(void *table, void *p, void *q) GS_HIDDEN;
|
||||
void _NS_owned_void_p_retain(void *table, void *p) GS_HIDDEN;
|
||||
void _NS_owned_void_p_release(void *table, void *p) GS_HIDDEN;
|
||||
NSString *_NS_owned_void_p_describe(void *table, void *p) GS_HIDDEN;
|
||||
|
||||
/** For non-retained Objective-C objects **/
|
||||
unsigned int _NS_non_retained_id_hash(void *table, id <NSObject> o);
|
||||
BOOL _NS_non_retained_id_is_equal(void *table, id <NSObject> o, id <NSObject> p);
|
||||
void _NS_non_retained_id_retain(void *table, id <NSObject> o);
|
||||
void _NS_non_retained_id_release(void *table, id <NSObject> o);
|
||||
NSString *_NS_non_retained_id_describe(void *table, id <NSObject> o);
|
||||
unsigned int _NS_non_retained_id_hash(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
BOOL _NS_non_retained_id_is_equal(void *table,
|
||||
id <NSObject> o, id <NSObject> p) GS_HIDDEN;
|
||||
void _NS_non_retained_id_retain(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
void _NS_non_retained_id_release(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
NSString *_NS_non_retained_id_describe(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
|
||||
/** For(retainable) objects **/
|
||||
unsigned int _NS_id_hash(void *table, id <NSObject> o);
|
||||
BOOL _NS_id_is_equal(void *table, id <NSObject> o, id <NSObject> p);
|
||||
void _NS_id_retain(void *table, id <NSObject> o);
|
||||
void _NS_id_release(void *table, id <NSObject> o);
|
||||
NSString *_NS_id_describe(void *table, id <NSObject> o);
|
||||
unsigned int _NS_id_hash(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
BOOL _NS_id_is_equal(void *table, id <NSObject> o, id <NSObject> p) GS_HIDDEN;
|
||||
void _NS_id_retain(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
void _NS_id_release(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
NSString *_NS_id_describe(void *table, id <NSObject> o) GS_HIDDEN;
|
||||
|
||||
/** For(non-owned) `void *' **/
|
||||
unsigned int _NS_non_owned_void_p_hash(void *table, void *p);
|
||||
BOOL _NS_non_owned_void_p_is_equal(void *table, void *p, void *q);
|
||||
void _NS_non_owned_void_p_retain(void *table, void *p);
|
||||
void _NS_non_owned_void_p_release(void *table, void *p);
|
||||
NSString *_NS_non_owned_void_p_describe(void *table, void *p);
|
||||
unsigned int _NS_non_owned_void_p_hash(void *table, void *p) GS_HIDDEN;
|
||||
BOOL _NS_non_owned_void_p_is_equal(void *table, void *p, void *q) GS_HIDDEN;
|
||||
void _NS_non_owned_void_p_retain(void *table, void *p) GS_HIDDEN;
|
||||
void _NS_non_owned_void_p_release(void *table, void *p) GS_HIDDEN;
|
||||
NSString *_NS_non_owned_void_p_describe(void *table, void *p) GS_HIDDEN;
|
||||
|
||||
/** For pointers to structures and `int *' **/
|
||||
unsigned int _NS_int_p_hash(void *table, int *p);
|
||||
BOOL _NS_int_p_is_equal(void *table, int *p, int *q);
|
||||
void _NS_int_p_retain(void *table, int *p);
|
||||
void _NS_int_p_release(void *table, int *p);
|
||||
NSString *_NS_int_p_describe(void *table, int *p);
|
||||
unsigned int _NS_int_p_hash(void *table, int *p) GS_HIDDEN;
|
||||
BOOL _NS_int_p_is_equal(void *table, int *p, int *q) GS_HIDDEN;
|
||||
void _NS_int_p_retain(void *table, int *p) GS_HIDDEN;
|
||||
void _NS_int_p_release(void *table, int *p) GS_HIDDEN;
|
||||
NSString *_NS_int_p_describe(void *table, int *p) GS_HIDDEN;
|
||||
|
||||
#endif /* __NSCallBacks_h_OBJECTS_INCLUDE **/
|
||||
|
||||
|
|
|
@ -1952,7 +1952,7 @@ typedef struct _GSEnumeratedDirectory {
|
|||
} GSEnumeratedDirectory;
|
||||
|
||||
|
||||
inline void gsedRelease(GSEnumeratedDirectory X)
|
||||
static inline void gsedRelease(GSEnumeratedDirectory X)
|
||||
{
|
||||
DESTROY(X.path);
|
||||
_CLOSEDIR(X.pointer);
|
||||
|
|
|
@ -433,7 +433,7 @@ GNUstepConfig(NSDictionary *newConfig)
|
|||
if ([file hasPrefix: @"./"] == YES)
|
||||
{
|
||||
Class c = [NSProcessInfo class];
|
||||
NSString *path = objc_get_symbol_path (c, 0);
|
||||
NSString *path = GSPrivateSymbolPath (c, 0);
|
||||
|
||||
// Remove library name from path
|
||||
path = [path stringByDeletingLastPathComponent];
|
||||
|
|
|
@ -213,7 +213,7 @@ static BOOL fallbackInitialisation = NO;
|
|||
*** Implementing the gnustep_base_user_main function
|
||||
*************************************************************************/
|
||||
|
||||
void
|
||||
static void
|
||||
_gnu_process_args(int argc, char *argv[], char *env[])
|
||||
{
|
||||
CREATE_AUTORELEASE_POOL(arp);
|
||||
|
|
|
@ -39,89 +39,4 @@
|
|||
#define LINKER_GETSYMBOL 0
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
extern long objc_load_module(
|
||||
const unichar *filename,
|
||||
FILE *errorStream,
|
||||
void (*loadCallback)(Class, struct objc_category *),
|
||||
void **header,
|
||||
const unichar *debugFilename);
|
||||
|
||||
extern long objc_load_modules(
|
||||
const unichar *files[],
|
||||
FILE *errorStream,
|
||||
void (*callback)(Class,struct objc_category *),
|
||||
void **header,
|
||||
const unichar *debugFilename);
|
||||
#else
|
||||
extern long objc_load_module(
|
||||
const char *filename,
|
||||
FILE *errorStream,
|
||||
void (*loadCallback)(Class, struct objc_category *),
|
||||
void **header,
|
||||
const char *debugFilename);
|
||||
|
||||
extern long objc_load_modules(
|
||||
const char *files[],
|
||||
FILE *errorStream,
|
||||
void (*callback)(Class,struct objc_category *),
|
||||
void **header,
|
||||
const char *debugFilename);
|
||||
#endif
|
||||
|
||||
extern long objc_unload_module(
|
||||
FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *));
|
||||
|
||||
extern long objc_unload_modules(
|
||||
FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *));
|
||||
|
||||
/*
|
||||
* objc_get_symbol_path() returns the path to the object file from
|
||||
* which a certain class was loaded.
|
||||
*
|
||||
* If the class was loaded from a shared library, this returns the
|
||||
* filesystem path to the shared library; if it was loaded from a
|
||||
* dynamical object (such as a bundle or framework dynamically
|
||||
* loaded), it returns the filesystem path to the object file; if the
|
||||
* class was loaded from the main executable, it returns the
|
||||
* filesystem path to the main executable path.
|
||||
*
|
||||
* This function is implemented by using the available features of
|
||||
* the dynamic linker on the specific platform we are running on.
|
||||
*
|
||||
* On some platforms, the dynamic linker does not provide enough
|
||||
* facilities to support the objc_get_symbol_path() function at all;
|
||||
* in this case, objc_get_symbol_path() always returns nil.
|
||||
*
|
||||
* On my platform (a Debian GNU Linux), it seems the dynamic linker
|
||||
* always returns the filesystem path that was used to load the
|
||||
* module. So it returns the full filesystem path for shared libraries
|
||||
* and bundles (which is very nice), but unfortunately it returns
|
||||
* argv[0] (which might be something as horrible as './obj/test')
|
||||
* for classes in the main executable.
|
||||
*
|
||||
* If theCategory argument is not NULL, objc_get_symbol_path() will return
|
||||
* the filesystem path to the module from which the category theCategory
|
||||
* of the class theClass was loaded.
|
||||
*
|
||||
* Currently, the function will return nil if any of the following
|
||||
* conditions is satisfied:
|
||||
* - the required functionality is not available on the platform we are
|
||||
* running on;
|
||||
* - memory allocation fails;
|
||||
* - the symbol for that class/category could not be found.
|
||||
*
|
||||
* In general, if the function returns nil, it means something serious
|
||||
* went wrong in the system preventing it from getting the symbol path.
|
||||
* If your code is to be portable, you (unfortunately) have to be prepared
|
||||
* to work around it in some way when this happens.
|
||||
*
|
||||
* It seems that this function has no corresponding function in the NeXT
|
||||
* runtime ... as far as I know.
|
||||
*/
|
||||
extern
|
||||
NSString *objc_get_symbol_path (Class theClass, Category *theCategory);
|
||||
|
||||
#endif /* __objc_load_h_INCLUDE */
|
||||
|
|
|
@ -52,21 +52,16 @@
|
|||
#include "Foundation/NSDebug.h"
|
||||
#include "Foundation/NSException.h"
|
||||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
/* include the interface to the dynamic linker */
|
||||
#include "dynamic-load.h"
|
||||
|
||||
/* Declaration from NSBundle.m */
|
||||
#ifdef __MINGW32__
|
||||
const unichar *objc_executable_location (void);
|
||||
#else
|
||||
const char *objc_executable_location (void);
|
||||
#endif
|
||||
|
||||
/* dynamic_loaded is YES if the dynamic loader was sucessfully initialized. */
|
||||
static BOOL dynamic_loaded;
|
||||
|
||||
/* Our current callback function */
|
||||
void (*_objc_load_load_callback)(Class, struct objc_category *) = 0;
|
||||
static void (*_objc_load_load_callback)(Class, struct objc_category *) = 0;
|
||||
|
||||
/* List of modules we have loaded (by handle) */
|
||||
#ifndef NeXT_RUNTIME
|
||||
|
@ -106,31 +101,27 @@ objc_check_undefineds(FILE *errorStream)
|
|||
static int
|
||||
objc_initialize_loading(FILE *errorStream)
|
||||
{
|
||||
NSString *path;
|
||||
#ifdef __MINGW32__
|
||||
const unichar *path;
|
||||
const unichar *fsPath;
|
||||
#else
|
||||
const char *path;
|
||||
const char *fsPath;
|
||||
#endif
|
||||
|
||||
dynamic_loaded = NO;
|
||||
path = objc_executable_location();
|
||||
path = GSPrivateExecutablePath();
|
||||
|
||||
#ifdef __MINGW32__
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): initializing dynamic loader for %S",
|
||||
path);
|
||||
#else
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): initializing dynamic loader for %s",
|
||||
path);
|
||||
#endif
|
||||
@"Debug (objc-load): initializing dynamic loader for %@", path);
|
||||
|
||||
if (__objc_dynamic_init(path))
|
||||
fsPath = [[path stringByDeletingLastPathComponent] fileSystemRepresentation];
|
||||
|
||||
if (__objc_dynamic_init(fsPath))
|
||||
{
|
||||
if (errorStream)
|
||||
{
|
||||
__objc_dynamic_error(errorStream,
|
||||
"Error (objc-load): Cannot initialize dynamic linker");
|
||||
"Error (objc-load): Cannot initialize dynamic linker");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -155,25 +146,21 @@ objc_load_callback(Class class, struct objc_category * category)
|
|||
}
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
long
|
||||
objc_load_module (const unichar *filename,
|
||||
FILE *errorStream,
|
||||
void (*loadCallback)(Class, struct objc_category *),
|
||||
void **header,
|
||||
const unichar *debugFilename)
|
||||
#define FSCHAR unichar
|
||||
#else
|
||||
long
|
||||
objc_load_module (const char *filename,
|
||||
FILE *errorStream,
|
||||
void (*loadCallback)(Class, struct objc_category *),
|
||||
void **header,
|
||||
const char *debugFilename)
|
||||
#define FSCHAR char
|
||||
#endif
|
||||
|
||||
long
|
||||
GSPrivateLoadModule(NSString *filename, FILE *errorStream,
|
||||
void (*loadCallback)(Class, struct objc_category *),
|
||||
void **header, NSString *debugFilename)
|
||||
{
|
||||
#ifdef NeXT_RUNTIME
|
||||
int errcode;
|
||||
dynamic_loaded = YES;
|
||||
return objc_loadModule(filename, loadCallback, &errcode);
|
||||
return objc_loadModule([filename fileSystemRepresentation],
|
||||
loadCallback, &errcode);
|
||||
#else
|
||||
typedef void (*void_fn)();
|
||||
dl_handle_t handle;
|
||||
|
@ -195,14 +182,9 @@ objc_load_module (const char *filename,
|
|||
_objc_load_callback = objc_load_callback;
|
||||
|
||||
/* Link in the object file */
|
||||
#ifdef __MINGW32__
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): Linking file %S\n", filename);
|
||||
#else
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): Linking file %s\n", filename);
|
||||
#endif
|
||||
handle = __objc_dynamic_link(filename, 1, debugFilename);
|
||||
NSDebugFLLog(@"NSBundle", @"Debug (objc-load): Linking file %@\n", filename);
|
||||
handle = __objc_dynamic_link((FSCHAR*)[filename fileSystemRepresentation],
|
||||
1, (FSCHAR*)[debugFilename fileSystemRepresentation]);
|
||||
if (handle == 0)
|
||||
{
|
||||
if (errorStream)
|
||||
|
@ -232,7 +214,7 @@ objc_load_module (const char *filename,
|
|||
if (errorStream)
|
||||
{
|
||||
fprintf(errorStream,
|
||||
"Error (objc-load): Cannot load objects (no CTOR list)\n");
|
||||
"Error (objc-load): Cannot load objects (no CTOR list)\n");
|
||||
}
|
||||
_objc_load_load_callback = 0;
|
||||
_objc_load_callback = 0;
|
||||
|
@ -240,11 +222,11 @@ objc_load_module (const char *filename,
|
|||
}
|
||||
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): %d modules\n", (int)ctor_list[0]);
|
||||
@"Debug (objc-load): %d modules\n", (int)ctor_list[0]);
|
||||
for (i = 1; ctor_list[i]; i++)
|
||||
{
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): Invoking CTOR %p\n", ctor_list[i]);
|
||||
@"Debug (objc-load): Invoking CTOR %p\n", ctor_list[i]);
|
||||
ctor_list[i]();
|
||||
}
|
||||
#endif /* not __ELF__ */
|
||||
|
@ -257,8 +239,8 @@ objc_load_module (const char *filename,
|
|||
}
|
||||
|
||||
long
|
||||
objc_unload_module(FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *))
|
||||
GSPrivateUnloadModule(FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *))
|
||||
{
|
||||
if (!dynamic_loaded)
|
||||
{
|
||||
|
@ -272,54 +254,14 @@ objc_unload_module(FILE *errorStream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
long objc_load_modules(const unichar *files[],FILE *errorStream,
|
||||
void (*callback)(Class,struct objc_category *),
|
||||
void **header,
|
||||
const unichar *debugFilename)
|
||||
#else
|
||||
long objc_load_modules(const char *files[],FILE *errorStream,
|
||||
void (*callback)(Class,struct objc_category *),
|
||||
void **header,
|
||||
const char *debugFilename)
|
||||
#endif
|
||||
{
|
||||
while (*files)
|
||||
{
|
||||
if (objc_load_module(*files, errorStream, callback,
|
||||
(void *)header, debugFilename))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
files++;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long
|
||||
objc_unload_modules(FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *))
|
||||
{
|
||||
if (!dynamic_loaded)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (errorStream)
|
||||
{
|
||||
fprintf(errorStream, "Warning: unloading modules not implemented\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
NSString *
|
||||
objc_get_symbol_path(Class theClass, Category *theCategory)
|
||||
GSPrivateSymbolPath(Class theClass, Category *theCategory)
|
||||
{
|
||||
unichar buf[MAX_PATH];
|
||||
MEMORY_BASIC_INFORMATION memInfo;
|
||||
NSCAssert(!theCategory, @"objc_get_symbol_path doesn't support categories");
|
||||
NSCAssert(!theCategory, @"GSPrivateSymbolPath doesn't support categories");
|
||||
|
||||
VirtualQueryEx(GetCurrentProcess(), theClass, &memInfo, sizeof(memInfo));
|
||||
if (GetModuleFileNameW(memInfo.AllocationBase, buf, sizeof(buf)))
|
||||
|
@ -330,7 +272,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
|
|||
}
|
||||
#else
|
||||
NSString *
|
||||
objc_get_symbol_path(Class theClass, Category *theCategory)
|
||||
GSPrivateSymbolPath(Class theClass, Category *theCategory)
|
||||
{
|
||||
const char *ret;
|
||||
char buf[125], *p = buf;
|
||||
|
|
|
@ -26,8 +26,4 @@
|
|||
#include "GNUstepBase/preface.h"
|
||||
|
||||
const char *gnustep_base_version = STRINGIFY (GNUSTEP_BASE_VERSION);
|
||||
const char *o_gcc_version = STRINGIFY (GNUSTEP_BASE_GCC_VERSION);
|
||||
|
||||
#if NeXT_cc
|
||||
const char *o_NeXT_cc_version = STRINGIFY (NX_CURRENT_COMPILER_RELEASE);
|
||||
#endif /* NeXT_cc */
|
||||
|
|
Loading…
Reference in a new issue