Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(codegen): generate decl of store_dart_post_cobject when full_dep enabled #1773

Merged
merged 2 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ pub(crate) fn execute(
Ok(ans)
}

// Please keep in sync with frb_rust
// Please keep in sync with frb_rust and allo-isolate
const EXTRA_CODE: &str = "// EXTRA BEGIN
typedef struct DartCObject *WireSyncRust2DartDco;
typedef struct WireSyncRust2DartSse {
uint8_t *ptr;
int32_t len;
} WireSyncRust2DartSse;

typedef int64_t DartPort;
typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message);
void store_dart_post_cobject(DartPostCObjectFnType ptr);
// EXTRA END
";
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,4 @@ fn compute_dummy_var_operations(func_names: &[String]) -> String {
.join("\n")
}

const EXTRA_EXTERN_FUNC_NAMES: &[&str] = &[
"store_dart_post_cobject",
"get_dart_object",
"drop_dart_object",
"new_dart_opaque",
];
const EXTRA_EXTERN_FUNC_NAMES: &[&str] = &["store_dart_post_cobject"];
7 changes: 4 additions & 3 deletions frb_example/pure_dart/frb_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ typedef struct WireSyncRust2DartSse {
uint8_t *ptr;
int32_t len;
} WireSyncRust2DartSse;

typedef int64_t DartPort;
typedef bool (*DartPostCObjectFnType)(DartPort port_id, void *message);
void store_dart_post_cobject(DartPostCObjectFnType ptr);
// EXTRA END
typedef struct _Dart_Handle* Dart_Handle;

Expand Down Expand Up @@ -13318,7 +13322,6 @@ struct wire_cst_list_weekdays_twin_rust_async *frbgen_frb_example_pure_dart_cst_
struct wire_cst_list_weekdays_twin_sync *frbgen_frb_example_pure_dart_cst_new_list_weekdays_twin_sync(int32_t len);
static int64_t dummy_method_to_enforce_bundling(void) {
int64_t dummy_var = 0;
dummy_var ^= ((int64_t) (void*) drop_dart_object);
dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_application_env);
dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_Chrono_Duration);
dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_cst_new_box_autoadd_Chrono_Naive);
Expand Down Expand Up @@ -16427,8 +16430,6 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_use_msgid_twin_sse);
dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_use_msgid_twin_sync);
dummy_var ^= ((int64_t) (void*) frbgen_frb_example_pure_dart_wire_use_msgid_twin_sync_sse);
dummy_var ^= ((int64_t) (void*) get_dart_object);
dummy_var ^= ((int64_t) (void*) new_dart_opaque);
dummy_var ^= ((int64_t) (void*) store_dart_post_cobject);
return dummy_var;
}
19 changes: 19 additions & 0 deletions frb_example/pure_dart/lib/src/rust/frb_generated.io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34193,6 +34193,20 @@ class RustLibWire implements BaseWire {
lookup)
: _lookup = lookup;

void store_dart_post_cobject(
DartPostCObjectFnType ptr,
) {
return _store_dart_post_cobject(
ptr,
);
}

late final _store_dart_post_cobjectPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(DartPostCObjectFnType)>>(
'store_dart_post_cobject');
late final _store_dart_post_cobject = _store_dart_post_cobjectPtr
.asFunction<void Function(DartPostCObjectFnType)>();

void benchmark_raw_void_sync() {
return _benchmark_raw_void_sync();
}
Expand Down Expand Up @@ -93637,6 +93651,11 @@ class RustLibWire implements BaseWire {
_dummy_method_to_enforce_bundlingPtr.asFunction<int Function()>();
}

typedef DartPostCObjectFnType = ffi.Pointer<
ffi.NativeFunction<
ffi.Bool Function(DartPort port_id, ffi.Pointer<ffi.Void> message)>>;
typedef DartPort = ffi.Int64;

final class benchmark_raw_list_prim_u_8 extends ffi.Struct {
external ffi.Pointer<ffi.Uint8> ptr;

Expand Down
Loading