Skip to content

Translate function pointers and lambda#7

Merged
nunoplopes merged 17 commits intoCpp2Rust:masterfrom
lucic71:function-pointer
Apr 20, 2026
Merged

Translate function pointers and lambda#7
nunoplopes merged 17 commits intoCpp2Rust:masterfrom
lucic71:function-pointer

Conversation

@lucic71
Copy link
Copy Markdown
Contributor

@lucic71 lucic71 commented Apr 17, 2026

Sub-part of #3, only covers: translate function pointers and non-capturing lambdas as Option in unsafe and FnPtr in refcount

  • deleted the fn_ptr! macro, address is computed inside FnPtr::new using the FnAddr trait
  • replaced cast_history with the original function pointer + current cast
  • in unsafe function pointers + casts are translated using: Option<fn> + std::mem::transmute
  • in refcount function pointers + casts are translated using: FnPtr<fn> + FnPtr<fn>::cast

Comment thread libcc2rs/src/fn_ptr.rs Outdated
Comment thread libcc2rs/src/fn_ptr.rs Outdated
@nunoplopes nunoplopes merged commit 4cf3cd7 into Cpp2Rust:master Apr 20, 2026
6 of 9 checks passed
@lucic71 lucic71 deleted the function-pointer branch April 29, 2026 13:19
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