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:
fedor 1998-10-06 20:06:01 +00:00
parent 2cbffacdd7
commit 8c7267d074
12 changed files with 469 additions and 621 deletions

View file

@ -1,3 +1,10 @@
Tue Oct 6 16:35:48 1998 Adam Fedor <fedor@doc.com>
* aclocal.m4: Add win32 test
* configure.in: Use DYNAMIC_LINKER test.
* src/GNUmakefile: Add win32-load.h
* src/win32-load.h: New file.
Sat Oct 6 16:45:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk> Sat Oct 6 16:45:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/FastMap.x: New map table for dictionaries. * src/FastMap.x: New map table for dictionaries.

View file

@ -46,11 +46,6 @@
#include <gnustep/base/RBTreeNode.h> #include <gnustep/base/RBTreeNode.h>
#include <gnustep/base/SplayTree.h> #include <gnustep/base/SplayTree.h>
/* Magnitude objects */
#include <gnustep/base/Magnitude.h>
#include <gnustep/base/Random.h>
#include <gnustep/base/Time.h>
/* Stream objects */ /* Stream objects */
#include <gnustep/base/Stream.h> #include <gnustep/base/Stream.h>
#include <gnustep/base/StdioStream.h> #include <gnustep/base/StdioStream.h>

View file

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

View file

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

View file

@ -1,7 +1,7 @@
/* /*
hpux-load - Definitions and translations for dynamic loading with HP-UX 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> #include <dl.h>
/* This is the GNU name for the CTOR list */
#define CTOR_LIST "__CTOR_LIST__"
/* link flags */ /* link flags */
#define LINK_FLAGS (BIND_IMMEDIATE | BIND_VERBOSE) #define LINK_FLAGS (BIND_IMMEDIATE | BIND_VERBOSE)

View file

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

View file

@ -46,9 +46,6 @@ extern void sarray_free(struct sarray*);
/* Declaration from NSBundle.m */ /* Declaration from NSBundle.m */
const char *objc_executable_location( void ); 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. */ /* dynamic_loaded is YES if the dynamic loader was sucessfully initialized. */
static BOOL dynamic_loaded; static BOOL dynamic_loaded;

View file

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

8
aclocal.m4 vendored
View file

@ -105,20 +105,18 @@ AC_DEFUN(OBJC_SYS_DYNAMIC_LINKER,
# Makes the following substitutions: # Makes the following substitutions:
# DYNAMIC_LINKER - cooresponds to the interface that is included # DYNAMIC_LINKER - cooresponds to the interface that is included
# in objc-load.c (i.e. #include "${DYNAMIC_LINKER}-load.h") # in objc-load.c (i.e. #include "${DYNAMIC_LINKER}-load.h")
# LIBS - Updated to include the system library that
# performs dynamic linking.
#-------------------------------------------------------------------- #--------------------------------------------------------------------
DYNAMIC_LINKER=null DYNAMIC_LINKER=null
AC_CHECK_HEADER(dlfcn.h, DYNAMIC_LINKER=simple) AC_CHECK_HEADER(dlfcn.h, DYNAMIC_LINKER=simple)
if test $DYNAMIC_LINKER = null; then if test $DYNAMIC_LINKER = null; then
AC_CHECK_HEADER(dl.h, DYNAMIC_LINKER=hpux) AC_CHECK_HEADER(dl.h, DYNAMIC_LINKER=hpux)
fi fi
if test $DYNAMIC_LINKER = null; then
AC_CHECK_HEADER(windows.h, DYNAMIC_LINKER=win32)
fi
if test $DYNAMIC_LINKER = null; then if test $DYNAMIC_LINKER = null; then
AC_CHECK_HEADER(dld/defs.h, DYNAMIC_LINKER=dld) AC_CHECK_HEADER(dld/defs.h, DYNAMIC_LINKER=dld)
fi fi
# Should only include one of the following libs.
AC_CHECK_LIB(dl, dlopen, LIBS="${LIBS} -ldl")
AC_CHECK_LIB(dld, main, LIBS="${LIBS} -ldld")
AC_SUBST(DYNAMIC_LINKER)dnl AC_SUBST(DYNAMIC_LINKER)dnl
]) ])

957
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -183,7 +183,7 @@ AC_SUBST(NEXT_INCLUDES)
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Setup dynamic linking # Setup dynamic linking
#-------------------------------------------------------------------- #--------------------------------------------------------------------
OBJC_SYS_DYNAMIC_FLAGS() OBJC_SYS_DYNAMIC_LINKER()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Generic settings needed by NSZone.m # Generic settings needed by NSZone.m