Page MenuHomePhabricator

[native] restructure functions to be exposed across FFI boundary
ClosedPublic

Authored by varun on Aug 23 2022, 10:44 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 22, 10:19 AM
Unknown Object (File)
Tue, Nov 5, 2:06 AM
Unknown Object (File)
Sat, Oct 26, 12:28 PM
Unknown Object (File)
Oct 6 2024, 2:12 AM
Unknown Object (File)
Oct 6 2024, 2:12 AM
Unknown Object (File)
Oct 6 2024, 2:12 AM
Unknown Object (File)
Oct 6 2024, 2:09 AM
Unknown Object (File)
Sep 1 2024, 12:27 PM
Subscribers

Details

Summary

CXX doesn't have as much support for methods as I thought, so I'm changing the methods to normal functions that take an additional client param. We use a Box pointer because opaque Rust types can't be passed directly. I also removed all opaque Rust types from the return values of these functions.

Depends on D4935

Test Plan

cargo build, this is just a slight refactor even though it looks big

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested changes to this revision.Aug 24 2022, 3:08 AM

Could you explain a bit what do you mean by

CXX doesn't have as much support for methods as I thought

?
It seems like cxx supports methods https://cxx.rs/extern-rust.html#methods

This revision now requires changes to proceed.Aug 24 2022, 3:08 AM
In D4936#142927, @tomek wrote:

Could you explain a bit what do you mean by

CXX doesn't have as much support for methods as I thought

?
It seems like cxx supports methods https://cxx.rs/extern-rust.html#methods

Sorry, methods are supported. The issue is that it doesn't recognize the new() constructor in the impl block. I wasn't able to add this function to the ffi module

In D4936#143216, @varun wrote:
In D4936#142927, @tomek wrote:

Could you explain a bit what do you mean by

CXX doesn't have as much support for methods as I thought

?
It seems like cxx supports methods https://cxx.rs/extern-rust.html#methods

Sorry, methods are supported. The issue is that it doesn't recognize the new() constructor in the impl block. I wasn't able to add this function to the ffi module

Thanks for the explanation! It's surprising that cxx doesn't support that, but spending too much time on it doesn't make sense when we have a working solution.

This revision is now accepted and ready to land.Aug 25 2022, 1:37 AM