Add win32 dynamic loading.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@3034 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 1998-10-06 20:06:01 +00:00
parent 078c123074
commit 93c529ee3d
12 changed files with 469 additions and 621 deletions

View file

@ -205,7 +205,6 @@ LinkedList.h \
LinkedListNode.h \
Locking.h \
MachPort.h \
Magnitude.h \
MappedCollector.h \
MemoryStream.h \
NotificationDispatcher.h \
@ -216,9 +215,6 @@ Port.h \
Queue.h \
RBTree.h \
RBTreeNode.h \
RNGAdditiveCongruential.h \
RNGBerkeley.h \
RandomGenerating.h \
RawCStream.h \
Retaining.h \
RunLoop.h \
@ -230,7 +226,6 @@ Stream.h \
Streaming.h \
TcpPort.h \
TextCStream.h \
Time.h \
UdpPort.h \
Unicode.h \
UnixFileHandle.h \
@ -254,11 +249,17 @@ o_map.h \
o_map_bas.h \
o_map_cbs.h \
objc-gnu2next.h \
all.h \
README \
preface.h
#Random.h \
GNU_EXTRAS_HFILES = \
all.h \
Magnitude.h \
Random.h \
RNGAdditiveCongruential.h \
RNGBerkeley.h \
RandomGenerating.h \
Time.h
# NEXTSTEP source files
@ -378,6 +379,7 @@ dld-load.h \
hpux-load.h \
null-load.h \
simple-load.h \
win32-load.h \
NSCallBacks.h \
tzfile.h

View file

@ -1,7 +1,7 @@
/*
dld-load - Definitions and translations for dynamic loading with GNU dld.
Copyright (C) 1995, Adam Fedor.
Copyright (C) 1995, Free Software Foundation.
BUGS:
- object files loaded by dld must be loaded with 'ld -r' rather
@ -20,7 +20,7 @@
#include <dld/defs.h>
/* This is the GNU gcc name for the CTOR list */
#define DLD_CTOR_LIST "___CTOR_LIST__"
#define CTOR_LIST "___CTOR_LIST__"
/* The compiler generates a constructor function for each class. The function
has the prefix given below.

View file

@ -1,7 +1,7 @@
/*
hpux-load - Definitions and translations for dynamic loading with HP-UX
Copyright (C) 1995, Adam Fedor.
Copyright (C) 1995, Free Software Foundation
*/
@ -10,6 +10,9 @@
#include <dl.h>
/* This is the GNU name for the CTOR list */
#define CTOR_LIST "__CTOR_LIST__"
/* link flags */
#define LINK_FLAGS (BIND_IMMEDIATE | BIND_VERBOSE)

View file

@ -8,6 +8,7 @@
#ifndef __null_load_h_INCLUDE
#define __null_load_h_INCLUDE
#define CTOR_LIST ""
/* Types defined appropriately for the dynamic linker */
typedef void* dl_handle_t;

View file

@ -46,9 +46,6 @@ extern void sarray_free(struct sarray*);
/* Declaration from NSBundle.m */
const char *objc_executable_location( void );
/* This is the GNU name for the CTOR list */
#define CTOR_LIST "___CTOR_LIST__"
/* dynamic_loaded is YES if the dynamic loader was sucessfully initialized. */
static BOOL dynamic_loaded;

View file

@ -2,7 +2,7 @@
simple-load - Definitions and translations for dynamic loading with
the simple dynamic liading library (dl).
Copyright (C) 1995, Adam Fedor.
Copyright (C) 1995, Free Software Foundation
BUGS:
- In SunOS 4.1, dlopen will only resolve references into the main
@ -17,6 +17,9 @@
#include <dlfcn.h>
/* This is the GNU name for the CTOR list */
#define CTOR_LIST "__CTOR_LIST__"
#ifndef RTLD_GLOBAL
#define RTLD_GLOBAL 0
#endif

77
Source/win32-load.h Normal file
View file

@ -0,0 +1,77 @@
/*
win32-load - Definitions and translations for dynamic loading with
the windows.
Copyright (C) 1998, Free Software Foundation
*/
#ifndef __win32_load_h_INCLUDE
#define __win32_load_h_INCLUDE
#include <windows.h>
/* This is the GNU name for the CTOR list */
#define CTOR_LIST ""
/* Types defined appropriately for the dynamic linker */
typedef HINSTANCE dl_handle_t;
typedef void* dl_symbol_t;
/* Do any initialization necessary. Return 0 on success (or
if no initialization needed.
*/
static int
__objc_dynamic_init(const char* exec_path)
{
return 0;
}
/* Link in the module given by the name 'module'. Return a handle which can
be used to get information about the loded code.
*/
static dl_handle_t
__objc_dynamic_link(const char* module, int mode, const char* debug_file)
{
return LoadLibraryEx(module, 0, 0);
}
/* Return the address of a symbol given by the name 'symbol' from the module
associated with 'handle'
*/
static dl_symbol_t
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
{
return NULL;
}
/* remove the code from memory associated with the module 'handle' */
static int
__objc_dynamic_unlink(dl_handle_t handle)
{
return 0;
}
/* Print an error message (prefaced by 'error_string') relevant to the
last error encountered
*/
static void
__objc_dynamic_error(FILE *error_stream, const char *error_string)
{
fprintf(error_stream, "%s:%d\n", error_string, GetLastError());
}
/* Debugging: define these if they are available */
static int
__objc_dynamic_undefined_symbol_count(void)
{
return 0;
}
static char**
__objc_dynamic_list_undefined_symbols(void)
{
return NULL;
}
#endif /* __sunos_load_h_INCLUDE */