* Support for the BeOS dynamic loader.

git-svn-id: svn://svn.zoy.org/elk/trunk@225 55e467fa-43c5-0310-a8a2-de718669efc6
This commit is contained in:
sam 2003-10-05 13:11:41 +00:00
parent 68d95d0a0b
commit a632cd1797
2 changed files with 30 additions and 0 deletions

View File

@ -185,6 +185,14 @@ if test "${ac_cv_my_can_load_lib}" = "no"; then
ac_cv_my_can_load_lib=yes])
fi
# BeOS style
if test "${ac_cv_my_can_load_lib}" = "no"; then
AC_CHECK_HEADERS(image.h)
AC_CHECK_FUNCS(load_add_on,
[AC_DEFINE(HAVE_DL_BEOS, 1, [Define if you have the BeOS dl])
ac_cv_my_can_load_lib=yes])
fi
# Win32 style
if test "${ac_cv_my_can_load_lib}" = "no"; then
AC_CHECK_LIB(kernel32, main,

View File

@ -41,6 +41,8 @@
# include <mach-o/dyld.h>
#elif defined (WIN32)
# include <windows.h>
#elif defined (HAVE_IMAGE_H)
# include <image.h>
#elif defined (HAVE_DL_DLOPEN)
# if defined (HAVE_DLFCN_H)
# include <dlfcn.h>
@ -107,6 +109,19 @@ void Dlopen_File (char *obj) {
Make_String (obj, strlen (obj)));
}
#elif defined (HAVE_DL_BEOS)
int handle;
if (Verb_Load)
printf ("[load_add_on %s]\n", obj);
handle = load_add_on (obj);
if (handle < 0) {
Primitive_Error ("load_add_on failed on ~%~s",
Make_String (obj, strlen (obj)));
}
#elif defined (HAVE_DL_DLOPEN)
void *handle;
@ -158,6 +173,13 @@ void Dlopen_File (char *obj) {
#elif defined (WIN32)
sp->value = (unsigned long int)(intptr_t)GetProcAddress (handle, sp->name);
#elif defined (HAVE_DL_BEOS)
void *sym;
if (get_image_symbol (handle, sp->name, B_SYMBOL_TYPE_TEXT, &sym)
== B_OK) {
sp->value = (unsigned long int)(intptr_t)sym;
}
#elif defined (HAVE_DL_DLOPEN)
/* dlsym() may fail for symbols not exported by object file;
* this can be safely ignored. */