Repository navigation
0.4.4: the system's object models — windows::com and macos::objc - #24
Merged
Merged
Conversation
The services of a system that are objects rather than functions (toast notifications, the shell's dialogs, the Windows Runtime's classes; Foundation, AppKit, UserNotifications) are reached through two platform modules' new namespaces (R2, R5): declared on every target, defined on their own platform, not defined in an image. Their libraries are found when first used (ole32, combase; libobjc and libSystem's blocks through os::library), so nothing is added to a program's link and no system header is included. Windows: apartment, object (AddRef/Release paired), call by slot, query, create, hstring (UTF-8, R7), activate, factory, delegate (an agile object the system calls back), HRESULT -> errc. macOS: id (retain/release paired), send<R>, autorelease_pool, class_named, selector, load_framework, NSString to and from UTF-8, define_class, block. Tests: windows_test and macos_test (counterparts in checks/hosted and checks/emscripten, in CI's lists); the R5 discarded check covers a member template.
…hin mtest's ^0.4.1 (and a consumer's)
…class, not libobjc's (a string made before any framework was loaded was sent to nil)
…tform defines — object's and id's assignments (they release) and utf8(const id&) out of line; clang and MSVC on Windows emitted id::operator= into every program
…ade; a block's missing signature stated
Sunrisepeak
added a commit
to Sunrisepeak/mui
that referenced
this pull request
Nov 9, 2026
…s 0.4.4's object models — no system header; mpal on every system in minutes (mpal.yml) - mcpplibs.os 0.4.4 (mcpplibs/os#24, released, mcpp-index#746): windows::com and macos::objc. Every os pin moves to 0.4.4. - mpal:native (internal partition): a system's notification centre, declared everywhere, defined in src/macos and src/windows, built for that system alone; Notifier and notify() dispatch to it in a native macOS or Windows build. - macOS: UserNotifications for a program with a bundle identifier (a bare one is told: unavailable); permission asked once, a refusal with the system's reason; each notification's category carries its actions and asks for the dismissal; a delegate class (made at run time) brings the person's answer to Notifier::next; shown in front too. - Windows: Windows Runtime toasts; an unpackaged program is named by a Start menu shortcut with its AppUserModelID (IShellLinkW, IPropertyStore, IPersistFile, made when missing); Activated and Dismissed come back through com::delegate (weakly holding the centre); close hides the toast. - .github/workflows/mpal.yml: mpal's tests on Linux, macOS and Windows when mpal changes (the full matrix takes about two hours). - Tests: on macOS a bare program gets unavailable, and a copy of the test program inside a temporary .app (mtest child) gets "shown" or "refused" with the reason; on Windows a toast shown (or refused with its reason) and the shortcut made. The real-bus case waits for dbus-daemon to end before removing its directory (a race seen once). Verified locally: mcpp test -p mpal 8 passed (three runs) on os 0.4.4; lint 0. macOS and Windows: mpal.yml on this push.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Version 0.4.4: only additions, so a consumer's
^0.4(and mtest's^0.4.1, which the package under test must satisfy to stand for itself) still holds.Two platform modules gain the system's object models, through which its services that are objects rather than functions are reached (toast notifications, the shell's dialogs, the Windows Runtime's classes; Foundation, AppKit, UserNotifications):
mcpplibs::os::windows::com:apartment::enter,object(one reference, AddRef/Release paired),object::call(slot, args...),query,create,hstring(UTF-8 there and back),activate,factory,delegate(an agile object the system calls back:Invoke(sender, args)),id("…")at compile time,checked(HRESULT)→errc.mcpplibs::os::macos::objc:id(one reference, objc_retain/objc_release paired),send<R>(receiver, selector, args...),autorelease_pool,class_named,selector,load_framework,string/utf8(NSString),define_class(a delegate's methods),block(function)(a block the runtime holds and releases).The rules
if constexpr (os::is_windows).checks/discardednow covers a member template (object::call,objc::send) in a discarded branch.hstringand NSString from and to UTF-8; the tests carry four scripts and an emoji.os::library.Test plan
windows_test,macos_test(nothing to ask there),checks/discardedlinks.com.cpp,windows_test.cpp); that toolchain's link fails here for every test alike (libstdc++'s_Sp_make_shared_tagtwice), so the run is CI's.Urimade and its methods called by slot, an interface it lacks refused (not_supported), an unknown classnot_found, a delegate called back and released.available()isnot_supported.