-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdl.nelua
67 lines (67 loc) · 2.62 KB
/
dl.nelua
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
##[[
cdefine '_GNU_SOURCE'
cinclude '<dlfcn.h>'
if ccinfo.is_linux then
linklib 'dl'
end
]]
global function dlopen(file: cstring, mode: cint): pointer <cimport,nodecl> end
global function dlclose(handle: pointer): cint <cimport,nodecl> end
global function dlsym(handle: pointer, name: cstring): pointer <cimport,nodecl> end
global function dlmopen(nsid: clong, file: cstring, mode: cint): pointer <cimport,nodecl> end
global function dlvsym(handle: pointer, name: cstring, version: cstring): pointer <cimport,nodecl> end
global function dlerror(): cstring <cimport,nodecl> end
global Dl_info: type <cimport,nodecl> = @record{
dli_fname: cstring,
dli_fbase: pointer,
dli_sname: cstring,
dli_saddr: pointer
}
global function dladdr(address: pointer, info: *Dl_info): cint <cimport,nodecl> end
global function dladdr1(address: pointer, info: *Dl_info, extra_info: *pointer, flags: cint): cint <cimport,nodecl> end
global RTLD_DL_SYMENT: cint <comptime> = 1
global RTLD_DL_LINKMAP: cint <comptime> = 2
global function dlinfo(handle: pointer, request: cint, arg: pointer): cint <cimport,nodecl> end
global RTLD_DI_LMID: cint <comptime> = 1
global RTLD_DI_LINKMAP: cint <comptime> = 2
global RTLD_DI_CONFIGADDR: cint <comptime> = 3
global RTLD_DI_SERINFO: cint <comptime> = 4
global RTLD_DI_SERINFOSIZE: cint <comptime> = 5
global RTLD_DI_ORIGIN: cint <comptime> = 6
global RTLD_DI_PROFILENAME: cint <comptime> = 7
global RTLD_DI_PROFILEOUT: cint <comptime> = 8
global RTLD_DI_TLS_MODID: cint <comptime> = 9
global RTLD_DI_TLS_DATA: cint <comptime> = 10
global RTLD_DI_PHDR: cint <comptime> = 11
global RTLD_DI_MAX: cint <comptime> = 11
global Dl_serpath: type <cimport,nodecl> = @record{
dls_name: cstring,
dls_flags: cuint
}
global Dl_serinfo: type <cimport,nodecl> = @record{
dls_size: csize,
dls_cnt: cuint,
__unnamed1: union{
dls_serpath: [0]Dl_serpath,
__dls_serpath_pad: [1]Dl_serpath
}
}
global link_map: type <cimport,nodecl,forwarddecl,ctypedef> = @record{}
global dl_find_object: type <cimport,nodecl,ctypedef> = @record{
dlfo_flags: culonglong,
dlfo_map_start: pointer,
dlfo_map_end: pointer,
dlfo_link_map: *link_map,
dlfo_eh_frame: pointer,
__dflo_reserved: [7]culonglong
}
global RTLD_LAZY: cint <comptime> = 0x00001
global RTLD_NOW: cint <comptime> = 0x00002
global RTLD_BINDING_MASK: cint <comptime> = 0x3
global RTLD_NOLOAD: cint <comptime> = 0x00004
global RTLD_DEEPBIND: cint <comptime> = 0x00008
global RTLD_GLOBAL: cint <comptime> = 0x00100
global RTLD_LOCAL: cint <comptime> = 0
global RTLD_NODELETE: cint <comptime> = 0x01000
global RTLD_NEXT: pointer <cimport,nodecl,const>
global RTLD_DEFAULT: pointer <cimport,nodecl,const>