Skip to content

Commit e1cd845

Browse files
authored
mcpplibs.os 0.1.2: shared libraries at run time (mcpplibs.os.library) (#584)
mcpplibs/os#5 adds the dynamic loader: open a library by path or name, find one the process already has, look up its symbols, and resolve a symbol of the program as the loader does. openmui's Python binding reaches the interpreter's stable C API this way, without headers or an import library. The consumer test moves to 0.1.2 and resolves a program symbol.
1 parent c7ee0f8 commit e1cd845

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎pkgs/o/os.lua‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ package = {
2626

2727
xpm = {
2828
linux = {
29+
["0.1.2"] = {
30+
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.2.tar.gz",
31+
sha256 = "bf6f5cfb1518b045b693e246ee39306746074586434419d4052e648be111ea34",
32+
},
2933
["0.1.1"] = {
3034
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.1.tar.gz",
3135
sha256 = "c5abfb625ded0d5d837b799722c836c302460251d47081fef7a57a2a12e6b2b9",
@@ -39,6 +43,10 @@ package = {
3943
},
4044
},
4145
macosx = {
46+
["0.1.2"] = {
47+
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.2.tar.gz",
48+
sha256 = "bf6f5cfb1518b045b693e246ee39306746074586434419d4052e648be111ea34",
49+
},
4250
["0.1.1"] = {
4351
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.1.tar.gz",
4452
sha256 = "c5abfb625ded0d5d837b799722c836c302460251d47081fef7a57a2a12e6b2b9",
@@ -52,6 +60,10 @@ package = {
5260
},
5361
},
5462
windows = {
63+
["0.1.2"] = {
64+
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.2.tar.gz",
65+
sha256 = "bf6f5cfb1518b045b693e246ee39306746074586434419d4052e648be111ea34",
66+
},
5567
["0.1.1"] = {
5668
url = "https://github.com/mcpplibs/os/archive/refs/tags/0.1.1.tar.gz",
5769
sha256 = "c5abfb625ded0d5d837b799722c836c302460251d47081fef7a57a2a12e6b2b9",

‎tests/examples/os/mcpp.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ name = "os-tests"
66
version = "0.1.0"
77

88
[dependencies.mcpplibs]
9-
os = "0.1.1"
9+
os = "0.1.2"
1010

1111
[indices]
1212
mcpplibs = { path = "../../.." }

‎tests/examples/os/tests/os.cpp‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ int main(int argc, char** argv) {
4040
auto r = os::process::run(o);
4141
check(r && r->status.success() && r->out == "echoed", "a started program's output is read");
4242
}
43+
// 0.1.2: a symbol of the program resolves as the loader resolves it.
44+
if (os::library::supported())
45+
check(os::library::process_symbol(os::is_windows ? "GetCurrentProcessId" : "getpid") != nullptr, "a program symbol resolves");
4346
std::error_code ec;
4447
std::filesystem::remove_all(dir, ec);
4548
if (failures == 0) std::println("os-tests: held");

0 commit comments

Comments
 (0)