Skip to content

Commit

Permalink
Improve docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dcharkes committed Feb 27, 2024
1 parent 21d5f83 commit aa4d83e
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions pkgs/native_assets_cli/lib/src/api/c_code_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,25 @@ part of 'asset.dart';
/// Typical other languages which produce code assets that respect the C ABI
/// include C++ and Rust.
///
/// C code assets can be accessed at runtime through native external functions
/// via their asset [id]:
///
/// ```dart
/// import 'dart:ffi';
///
/// void main() {
/// final result = add(14, 28);
/// print(result);
/// }
///
/// @Native<Int Function(Int, Int)>(assetId: 'package:my_package/add.dart')
/// external int add(int a, int b);
/// ```
///
/// There are several types of C code assets:
/// * Assets which designate symbols present in the target system
/// ([SystemDylib]), process ([LookupInProcess]), or executable
/// ([LookupInExecutable]). These assets are identified by their [id], and do
/// not have a [file].
/// ([LookupInExecutable]). These assets do not have a [file].
/// * Dynamic libraries bundled into the application ([BundledDylib]). These
/// assets must provide a [file] to be bundled.
///
Expand All @@ -28,9 +42,6 @@ part of 'asset.dart';
/// target system ([SystemDylib]). If the asset is bundled "manually", the Dart
/// or Flutter SDK will take care of copying the asset [file] from its specified
/// location on the current system into the application bundle.
///
/// Assets are also called "native assets" to differentiate them from the Dart
/// code also bundled with an application.
abstract final class CCodeAsset implements Asset {
/// The operating system this asset can run on.
OS get os;
Expand Down

0 comments on commit aa4d83e

Please sign in to comment.