-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
/
jl_exports.h
79 lines (69 loc) · 2.22 KB
/
jl_exports.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// This file is a part of Julia. License is MIT: https://julialang.org/license
// Bring in the curated lists of exported data and function symbols, then
// perform C preprocessor magic upon them to generate lists of declarations and
// functions to re-export our function symbols from libjulia-internal to libjulia.
#include "../src/jl_exported_data.inc"
#include "../src/jl_exported_funcs.inc"
// Define pointer data as `const void * $(name);`
#define XX(name) JL_DLLEXPORT const void * name;
JL_EXPORTED_DATA_POINTERS(XX)
#undef XX
// Define symbol data as `$(type) $(name);`
#define XX(name, type) JL_DLLEXPORT type name;
JL_EXPORTED_DATA_SYMBOLS(XX)
#undef XX
// define a copy of exported data
#define jl_max_tags 64
JL_DLLEXPORT void *jl_small_typeof[(jl_max_tags << 4) / sizeof(void*)]; // 16-bit aligned, like the GC
// Declare list of exported functions (sans type)
#define XX(name) JL_DLLEXPORT void name(void);
typedef void (anonfunc)(void);
JL_RUNTIME_EXPORTED_FUNCS(XX)
#ifdef _OS_WINDOWS_
JL_RUNTIME_EXPORTED_FUNCS_WIN(XX)
#endif
JL_CODEGEN_EXPORTED_FUNCS(XX)
#undef XX
// Define holder locations for function addresses as `const void * $(name)_addr = NULL;
#define XX(name) JL_HIDDEN anonfunc * name##_addr = NULL;
JL_RUNTIME_EXPORTED_FUNCS(XX)
#ifdef _OS_WINDOWS_
JL_RUNTIME_EXPORTED_FUNCS_WIN(XX)
#endif
JL_CODEGEN_EXPORTED_FUNCS(XX)
#undef XX
// Generate lists of function names and addresses
#define XX(name) "i" #name,
static const char *const jl_runtime_exported_func_names[] = {
JL_RUNTIME_EXPORTED_FUNCS(XX)
#ifdef _OS_WINDOWS_
JL_RUNTIME_EXPORTED_FUNCS_WIN(XX)
#endif
NULL
};
#undef XX
#define XX(name) #name"_impl",
static const char *const jl_codegen_exported_func_names[] = {
JL_CODEGEN_EXPORTED_FUNCS(XX)
NULL
};
#undef XX
#define XX(name) #name"_fallback",
static const char *const jl_codegen_fallback_func_names[] = {
JL_CODEGEN_EXPORTED_FUNCS(XX)
NULL
};
#undef XX
#define XX(name) &name##_addr,
static anonfunc **const jl_runtime_exported_func_addrs[] = {
JL_RUNTIME_EXPORTED_FUNCS(XX)
#ifdef _OS_WINDOWS_
JL_RUNTIME_EXPORTED_FUNCS_WIN(XX)
#endif
NULL
};
static anonfunc **const jl_codegen_exported_func_addrs[] = {
JL_CODEGEN_EXPORTED_FUNCS(XX)
NULL
};
#undef XX