Skip to content

Document \by_value\ FFI annotation - #598

Open
SeanTAllen wants to merge 1 commit into
mainfrom
by-value-ffi-tutorial
Open

SeanTAllen wants to merge 1 commit into
mainfrom
by-value-ffi-tutorial

Conversation

@SeanTAllen

@SeanTAllen SeanTAllen commented Sep 13, 2026

Copy link
Copy Markdown
Member

Document the \by_value\ FFI annotation from ponylang/ponyc#6062.

Changes:

  • Replace the two "Can I pass/return structs by value? Not at the moment" paragraphs in docs/c-ffi/calling-c.md with documentation of the new feature — passing structs by value, returning structs by value, and combining both
  • Add a by_value entry to docs/appendices/annotations.md with cross-references to the calling-c page
  • Add four code samples demonstrating parameter-only, return-only, combined, and annotation-reference usage
  • Update the "What can be annotated" section to note that FFI declarations accept annotations on parameter and return types
  • Add a qualifier to the existing "C function needs to return a pointer" text so it remains accurate alongside the new \by_value\ content
  • Link to the C shims page as a workaround when struct fields don't meet the \by_value\ restrictions

Merging blocked on ponyc 0.73.0 release (ponylang/ponyc#6063).

@netlify

netlify Bot commented Sep 13, 2026

Copy link
Copy Markdown

Deploy Preview for pony-tutorial ready!

Name Link
🔨 Latest commit 88aee35
🔍 Latest deploy log https://app.netlify.com/projects/pony-tutorial/deploys/6aa6de29a321d00008c7f9a1
😎 Deploy Preview https://deploy-preview-598--pony-tutorial.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@SeanTAllen SeanTAllen mentioned this pull request Sep 13, 2026
5 tasks
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Sep 13, 2026
@SeanTAllen SeanTAllen added do not merge This PR should not be merged at this time and removed discuss during sync Should be discussed during an upcoming sync labels Sep 13, 2026
Pony's FFI passes all structs as pointers. ponyc PR #6062 adds a
\by_value\ annotation that generates a wrapper so C functions expecting
structs by value work without hand-written C shims.
@SeanTAllen
SeanTAllen force-pushed the by-value-ffi-tutorial branch from 8f37b53 to 88aee35 Compare September 13, 2026 17:32
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss during sync Should be discussed during an upcoming sync do not merge This PR should not be merged at this time

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants