Skip to content

Commit

Permalink
Updated bindgen temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
ko1N committed Apr 4, 2024
1 parent 9ce52de commit 17549ae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 2 additions & 6 deletions memflow-ffi/bindgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,10 @@ run_twice() {
# remove any RUSTC_WRAPPER like sccache which might cause issues with cglue-bindgen
export RUSTC_WRAPPER=""

# update cglue-bindgen
# update cglue-bindgen (see https://github.com/h33p/cglue/pull/15)
cargo +nightly install cbindgen
cargo +nightly install cglue-bindgen
cargo +nightly install https://github.com/ko1N/cglue/cglue-bindgen

# generate c and cpp bindings
run_twice rustup run nightly cglue-bindgen +nightly -c cglue.toml -- --config cbindgen.toml --crate memflow-ffi --output memflow.h -l C
run_twice rustup run nightly cglue-bindgen +nightly -c cglue.toml -- --config cbindgen.toml --crate memflow-ffi --output memflow.hpp -l C++

# temporary workaround
sed -i 's/void ctx_arc_drop/static inline void ctx_arc_drop/i' memflow.h
sed -i 's/void cont_box_drop/static inline void cont_box_drop/i' memflow.h
2 changes: 1 addition & 1 deletion memflow-ffi/memflow.h
Original file line number Diff line number Diff line change
Expand Up @@ -2648,7 +2648,7 @@ uint8_t mf_arch_address_space_bits(const struct ArchitectureObj *arch);
void mf_arch_free(struct ArchitectureObj *arch);

bool mf_is_x86_arch(const struct ArchitectureObj *arch);
static CArc_c_void ctx_arc_clone(CArc_c_void *self) {
static inline CArc_c_void ctx_arc_clone(CArc_c_void *self) {
CArc_c_void ret = *self;
ret.instance = self->clone_fn(self->instance);
return ret;
Expand Down
4 changes: 2 additions & 2 deletions memflow-ffi/verify_headers.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

# update cglue-bindgen
# update cglue-bindgen (see https://github.com/h33p/cglue/pull/15)
cargo +nightly install cbindgen
cargo +nightly install cglue-bindgen
cargo +nightly install https://github.com/ko1N/cglue/cglue-bindgen

DIFFC=$(diff memflow.h <(rustup run nightly cglue-bindgen +nightly -c cglue.toml -- --config cbindgen.toml --crate memflow-ffi -l C))
DIFFCPP=$(diff memflow.hpp <(rustup run nightly cglue-bindgen +nightly -c cglue.toml -- --config cbindgen.toml --crate memflow-ffi -l C++))
Expand Down

0 comments on commit 17549ae

Please sign in to comment.