-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathloading-flow.puml
More file actions
74 lines (54 loc) · 1.48 KB
/
loading-flow.puml
File metadata and controls
74 lines (54 loc) · 1.48 KB
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
@startuml dlutils-loading-flow
!theme plain
title Library Loading Flow
start
:User creates instance
of user-defined class
(e.g., LibCrypto);
note right
Singleton pattern:
static LibCrypto& GetInstance()
end note
:Constructor calls
LoadAll();
partition "LoadAll() Method" {
:Call SelfDlOpen();
:dlopen(libName, RTLD_NOW | RTLD_GLOBAL);
if (libptr == nullptr?) then (Yes)
:throw std::runtime_error
"Failed to load library";
stop
else (No)
:Library loaded successfully;
:For each function:
DLUTILS_SELF_DLSYM(name);
partition "SelfDlSym()" {
:Check if library loaded;
if (libptr == nullptr?) then (Yes)
:throw std::runtime_error
"Library not loaded";
stop
else (No)
:dlerror() to clear previous errors;
:dlsym(libptr, funName);
if (error != nullptr || funPtr == nullptr?) then (Yes)
:throw std::runtime_error
"Failed to load symbol";
stop
else (No)
:Create DlFun wrapper
with function pointer;
:Store in outFun parameter;
endif
endif
}
note right
Macro expands to:
SelfDlSym("function_name", function_name)
end note
endif
}
:All functions loaded
and ready to use;
stop
@enduml