Implement objc_get_symbol_path() for mingw

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21537 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2005-07-25 16:15:37 +00:00
parent 151f6ba9b9
commit 5671b24ffd
2 changed files with 19 additions and 0 deletions

View file

@ -5,6 +5,7 @@
* Source/GSFormat.m: Fix %S format.
* Source/NSObject.m: ([conformsToProtocol:]) return NO if passed nul.
* Source/NSBundle.m: be more tolerant.
* Source/objc-load.m: Implemented objc_get_symbol_path() for windows.
2005-07-24 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -49,6 +49,7 @@
#include "objc-load.h"
#include "Foundation/NSString.h"
#include "Foundation/NSDebug.h"
#include "Foundation/NSException.h"
/* include the interface to the dynamic linker */
#include "dynamic-load.h"
@ -287,6 +288,22 @@ objc_unload_modules(FILE *errorStream,
return 0;
}
#ifdef __MINGW__
NSString *
objc_get_symbol_path(Class theClass, Category *theCategory)
{
char buf[MAX_PATH];
MEMORY_BASIC_INFORMATION memInfo;
NSCAssert(!theCategory, @"objc_get_symbol_path doesn't support categories");
VirtualQueryEx(GetCurrentProcess(), theClass, &memInfo, sizeof(memInfo));
if (GetModuleFileName(memInfo.AllocationBase, buf, sizeof(buf)))
{
return [NSString stringWithCString:buf];
}
return 0;
}
#else
NSString *
objc_get_symbol_path(Class theClass, Category *theCategory)
{
@ -348,3 +365,4 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
return nil;
}
#endif