File: dld-foreign.h

package info (click to toggle)
xlispstat 3.52.0-3
  • links: PTS
  • area: main
  • in suites: hamm, slink
  • size: 7,472 kB
  • ctags: 12,480
  • sloc: ansic: 89,534; lisp: 21,690; sh: 1,525; makefile: 520; csh: 1
file content (48 lines) | stat: -rw-r--r-- 1,115 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#define SHLIB_DYNLOAD /* not really */

#define INTERNAL_CNAME_PATTERN "%s"
#define INTERNAL_FNAME_PATTERN "%s_" /**** check this */
#define VERBDFLT TRUE

LOCAL VOID link_and_load _((char *fname, char *libs, int fort));
LOCAL char *get_caddress _((char *name));

/*#include <dld.h>*/
/* I don't want to bother looking for this include file, so I'll just */
/* declare the routines I need */
extern int dld_init(), dld_link();
extern unsigned long dld_get_func();

/**** This code ought to cache the addresses found, but I won't bother
until I revise the way dynamic loading works */

static int dld_initialized = FALSE;

LOCAL VOID link_and_load(fname, libs, fort)
     char *fname, *libs;
     int fort;
{
  if (! dld_initialized) {
    if (dld_init(progname))
      xlfail("dld initialization failed");
    dld_initialized = TRUE;
  }
  
  if (dld_link(fname)) {
    sprintf(buf, "can't open %s", fname);
    xlfail(buf);
  }
}

LOCAL char *get_caddress(name)
     char *name;
{
  LVAL next;
  void *handle;
  char *f;

  if (dld_initialized) 
    return((char *) dld_get_func(name));
  else
    return(NULL);
}