added Artur's OSX dlload() emulation, with minor changes
[imager.git] / dynaload.h
CommitLineData
02d1d628
AMH
1#ifndef _DYNALOAD_H_
2#define _DYNALOAD_H_
3
4#include "log.h"
5
6#if defined(OS_hpux)
7#include <dl.h>
8typedef shl_t minthandle_t;
9#elif defined(WIN32)
10#define WIN32_LEAN_AND_MEAN
11#include <windows.h>
12typedef HMODULE minthandle_t;
13#undef WIN32_LEAN_AND_MEAN
b6cfd214
TC
14#elif defined(OS_darwin)
15#define DL_LOADONCEONLY
16#define DLSYMUN
17#undef environ
18#undef bool
19
20#import <mach-o/dyld.h>
21typedef void *minthandle_t;
02d1d628
AMH
22#else
23#include <dlfcn.h>
24typedef void *minthandle_t;
25#endif
26
27#include "EXTERN.h"
28#include "perl.h"
29#include "ppport.h"
30
31#include "ext.h"
32
33typedef struct {
34 minthandle_t handle;
35 char *filename;
36 func_ptr *function_list;
37} DSO_handle;
38
39typedef struct {
40 HV* hv;
41 char *key;
42 void *store;
43} UTIL_args;
44
45int getobj(void *hv_t,char *key,char *type,void **store);
46int getint(void *hv_t,char *key,int *store);
47int getdouble(void *hv_t,char *key,double *store);
48int getvoid(void *hv_t,char *key,void **store);
49
50
51void *DSO_open(char* file,char** evalstring);
52int DSO_close(void *);
53void DSO_call(DSO_handle *handle,int func_index,HV* hv);
54
55#ifdef __EMX__ /* OS/2 */
56# ifndef RTLD_LAZY
57# define RTLD_LAZY 0
58# endif /* RTLD_LAZY */
59int dlclose(minthandle_t);
60#endif /* __EMX__ */
61
62#ifdef DLSYMUN
63
64#define I_EVALSTR "_evalstr"
65#define I_SYMBOL_TABLE "_symbol_table"
66#define I_UTIL_TABLE "_util_table"
67#define I_FUNCTION_LIST "_function_list"
68#define I_INSTALL_TABLES "_install_tables"
69
70#else
71
72#define I_EVALSTR "evalstr"
73#define I_SYMBOL_TABLE "symbol_table"
74#define I_UTIL_TABLE "util_table"
75#define I_FUNCTION_LIST "function_list"
76#define I_INSTALL_TABLES "install_tables"
77
78#endif
79
80#endif /* _DYNALOAD_H_ */
81