version 1.33, 2008/10/09 16:30:56
|
version 1.34, 2008/10/09 16:43:54
|
Line 37
|
Line 37
|
#include <fcntl.h> |
#include <fcntl.h> |
#include <time.h> |
#include <time.h> |
#endif |
#endif |
|
#if defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) /* what else? */ |
|
#include <dlfcn.h> |
|
#endif |
|
|
#ifdef HAS_FILE |
#ifdef HAS_FILE |
char *cstr(Char *from, UCell size, int clear) |
char *cstr(Char *from, UCell size, int clear) |
Line 536 void gforth_ms(UCell u)
|
Line 539 void gforth_ms(UCell u)
|
UCell gforth_dlopen(Char *c_addr, UCell u) |
UCell gforth_dlopen(Char *c_addr, UCell u) |
{ |
{ |
char * file=tilde_cstr(c_addr, u, 1); |
char * file=tilde_cstr(c_addr, u, 1); |
#ifdef HAVE_LIBLTDL |
int lib; |
return (UCell)lt_dlopen(file); |
#if defined(HAVE_LIBLTDL) |
|
lib = (UCell)lt_dlopen(file); |
|
if(lib) return lib; |
#elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) |
#elif defined(HAVE_LIBDL) || defined(HAVE_DLOPEN) |
#ifndef RTLD_GLOBAL |
#ifndef RTLD_GLOBAL |
#define RTLD_GLOBAL 0 |
#define RTLD_GLOBAL 0 |
#endif |
#endif |
return (UCell)dlopen(file, RTLD_GLOBAL | RTLD_LAZY); |
lib = (UCell)dlopen(file, RTLD_GLOBAL | RTLD_LAZY); |
#else |
if(lib) return lib; |
# ifdef _WIN32 |
#elif defined(_WIN32) |
return (Cell) GetModuleHandle(file); |
lib = (UCell) GetModuleHandle(file); |
# else |
if(lib) return lib; |
#warning Define open-lib! |
|
return 0; |
|
# endif |
|
#endif |
#endif |
|
return 0; |
} |
} |
|
|
#endif /* !defined(STANDALONE) */ |
#endif /* !defined(STANDALONE) */ |