Skip to content

Conversation

@alycda
Copy link

@alycda alycda commented Nov 18, 2025

  • I solemnly swear that this is all original content of which I am the original author
  • Pull request title is prepended with [language/lang-code] (example [python/fr] for Python in French or [java] for multiple Java translations)
  • Pull request touches only one file (or a set of logically related files with similar changes made)
  • Content changes are aimed at intermediate to experienced programmers (this is a poor format for explaining fundamental programming concepts)
  • If you've changed any part of the YAML Frontmatter, make sure it is formatted according to CONTRIBUTING.md

alycda and others added 3 commits November 17, 2025 18:06
Added comprehensive FFI documentation covering:
- Loading C libraries across platforms (Windows/macOS/Linux)
- Calling C functions from Dart
- Working with C structs using ffi.Struct
- Pointer manipulation and array handling
- C string conversion (UTF-8)
- FFI callbacks for C->Dart function calls
- Memory management best practices
- Complete C to Dart type mapping reference

Also updated Further Reading section with FFI resources.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Enhanced FFI documentation with production-ready patterns:
- Opaque pointers for encapsulating C struct internals
- Output parameters pattern (pointer-to-pointer technique)
- Error handling with C return codes and Dart exceptions
- Finalizers for automatic garbage collection cleanup
- Multiple DynamicLibrary loading strategies
- FFI wrapper class pattern with dispose and state validation

These examples are based on real-world patterns from dart-libkv
and demonstrate professional FFI development practices including
proper resource lifecycle management and idiomatic Dart wrappers
around C APIs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@alycda alycda changed the title dart/en FFI [dart/en] FFI Nov 18, 2025
@alycda alycda changed the title [dart/en] FFI [dart/en] add FFI examples Nov 18, 2025
import "dart:collection";
import "dart:math" as math;
import "dart:ffi" as ffi;
import "dart:io" show Platform;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add an explanation for show

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants