This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/H/Foreign.h

139 lines
2.8 KiB
C
Raw Normal View History

/*************************************************************************
2017-11-11 02:15:59 +00:00
* *
* YAP Prolog *
* *
* Yap Prolog was developed at NCCUP - Universidade do Porto *
* *
* Copyright L.Damas, V.S.Costa and Universidade do Porto 1985-97 *
* *
**************************************************************************
* *
* File: Foreign.h *
* comments: header file for dynamic loading routines *
*************************************************************************/
#define NO_DYN 1
2015-07-06 12:01:55 +01:00
#ifndef FOREIGN_H
#define FOREIGN_H
2017-11-11 02:15:59 +00:00
/**
2017-04-07 23:10:59 +01:00
@:
@file Foreign.h
2017-04-07 23:10:59 +01:00
load_foreign_files/3 has works for the following configurations:
- linux: should work both for a.out (untested by me) and ELF;
2017-11-11 02:15:59 +00:00
2017-04-07 23:10:59 +01:00
- WIN32: works (notice that symbols are not exported by default)
- OSX: works using Mach dynamic libs.
- osf: should work, but isn't working yet.
2017-11-11 02:15:59 +00:00
2017-04-07 23:10:59 +01:00
- sunos4: should work, using A.OUT format;
2017-11-11 02:15:59 +00:00
2017-04-07 23:10:59 +01:00
- svr4, eg solaris: should work, using ELF format;
- AIX: should work for 3.2 and 4.1 at least, using ECOFF;
2017-11-11 02:15:59 +00:00
2017-04-07 23:10:59 +01:00
YAP should be able to load on most BSD Unixes, but you will need to
say that here.
YAP also supports COFF loading (pretty much the same technique as
2017-11-11 02:15:59 +00:00
used for A.OUT loading) but that is untested so far.
*/
2017-11-11 02:15:59 +00:00
#include "Yap.h"
#include "YapHeap.h"
#ifdef _AIX
#undef NO_DYN
#endif /* __AIX */
2016-01-31 10:23:27 +00:00
#ifdef HAVE_DLOPEN
#define LOAD_DL 1
#ifdef NO_DYN
#undef NO_DYN
#endif
#endif /* LOAD_DL */
#if defined(sparc) || defined(__sparc)
#undef NO_DYN
#if (!defined(__svr4__) && !defined(__SVR4))
#define A_OUT 1
#else
#ifdef SIMICS
#define NO_DYN 1
#else
#define LOAD_DL 1
#endif
#endif
#endif
#if defined(_WIN32)
#ifdef NO_DYN
#undef NO_DYN
#define LOAD_DLL 1
#endif
#if LOAD_DL
#undef LOAD_DL
#endif
#endif
#ifdef __hpux
#ifdef NO_DYN
#undef NO_DYN
#endif
#define LOAD_SHL 1
#endif
#ifdef HAVE_NSLINKMODULE
#ifdef NO_DYN
#undef NO_DYN
#endif
#if !HAVE_DLOPEN
#define LOAD_DYLD 1
#endif
#endif /* LOAD_DYLD */
2017-11-11 02:15:59 +00:00
#define LOAD_SUCCEEDED 0
#define LOAD_FAILLED -1
typedef struct StringListItem {
Atom name;
void *handle;
struct StringListItem *next;
} StringListItem, *StringList;
typedef struct ForeignLoadItem {
StringList objs;
StringList libs;
2012-06-11 22:11:30 +01:00
Atom f;
2009-10-30 23:59:00 +00:00
Term module;
struct ForeignLoadItem *next;
} ForeignObj;
typedef void (*YapInitProc)(void);
2017-11-11 02:15:59 +00:00
void *Yap_LoadForeignFile(char *, int);
int Yap_CallForeignFile(void *, char *);
int Yap_CloseForeignFile(void *);
Int Yap_LoadForeign(StringList, StringList, char *, YapInitProc *);
Int Yap_ReLoadForeign(StringList, StringList, char *, YapInitProc *);
void Yap_ReOpenLoadForeign(void);
void Yap_ShutdownLoadForeign(void);
2017-11-11 02:15:59 +00:00
#define EAGER_LOADING 1
#define GLOBAL_LOADING 2
2015-07-06 12:01:55 +01:00
2018-07-15 13:44:55 +01:00
/**
* stub can always be called at DLL loading.
*
*/
X_API bool load_none(void);
2015-07-06 12:01:55 +01:00
#endif