Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically dispose COM and WinRT objects with NativeFinalizer #623

Merged
merged 19 commits into from
Dec 23, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 3 additions & 19 deletions lib/winrt.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,12 @@
/// final calendar = ICalendar.fromRawPointer(comObject);
/// ```
///
/// The object should be disposed of when it is no longer in use, for example:
/// When you have finished using a Windows Runtime interface, you should release
/// it with the `release` method:
///
/// ```dart
/// free(calendar.ptr);
/// calendar.release(); // Release the interface
/// ```
///
/// ## Strings in the Windows Runtime
///
/// Windows Runtime APIs use `HSTRING` as their native type. An `HSTRING` is an
/// immutable string object, which is created with the [WindowsCreateString] API
/// and deleted with the [WindowsDeleteString] API. The `HSTRING` itself is an
/// integer value, just like other `HANDLE` objects in the Win32 programming
/// interface.
///
/// Helper functions exist to easily convert between the Dart `String` type and
/// Windows Runtime strings: specifically, [convertToHString] and
/// [convertFromHString].
///
/// Make sure you dispose of `HSTRING`s by calling `WindowsDeleteString`; you do
/// not need to free the pointer itself, since Windows reference counts the
/// backing store and frees the memory when the reference count reaches 0.

library winrt;

// The WinRT API builds on the underlying Win32 API, and so it is also exported
Expand Down