17 Commits

Author SHA1 Message Date
Daniel Henry-Mantilla 27d86048be Fix Rust bindings (#437)
- A bool coming from C cannot be trusted; functionally it is a c_int,
    and conversion to bool must be done by comparing to 0;

  - similarly, a `#[repr(C)]` enum cannot be trusted to be a `u32`;
    it is more often than not a `c_int`. This could cause breakage with
    the ABI of the C functions of the binding. So the signatures and
    enum definitions have been adapted based on the
    `include/keystone/keystone.h` definitions.

  - and most importantly: a ks_handle is a `ks_engine *` in C parlance,
    and using `size_t` to represent it is not the right way. Moreover,
    so doing prevents the `Sync` and `Send` traits from being
    auto-unimplemented, meaning that this is implicitly asserting that
    keystone is multithread-safe, even for the same instance. If that is
    the case, then a `unsafe impl Sync for Keystone {}` (ditto for
    `Send`) should be added to make such assertion explicit.

    That's why an opaque type using the classic Rust idiom of a
    zero_sized #[repr(C)] struct has been made (while waiting for Rust
    to feature external types), and `Option<ptr::NonNull<_>>` is being
    used as the pointer type (equivalent to *mut _), but it allows to
    communicate nullable / non-nullable invariants at the type-level.
    This has then been transposed to the internals of keystone-rs.
2020-02-15 08:16:41 +08:00
Boris-Chengbiao Zhou ffe054aaa9 Various improvements to the Rust bindings (#401)
* Fix Rust bindings

* Various small improvements for the Rust bindings

* Remove unused dependencies

* Use the cmake crate to compile keystone

* Add Windows support to Rust bindings

* Cleanup doc a bit

* Fix symlink path

* Link to C++ standard library

* Build all keystone targets
2019-08-02 21:42:21 +08:00
Tasuku SUENAGA a.k.a. gunyarakun f231d0d843 bindings: include keystone itself on Rust bindings (#324) 2018-09-16 21:48:20 +08:00
gmorenz 2829223952 Fix use after free in Rust bindings (#334) 2018-04-01 20:56:00 +08:00
Nguyen Anh Quynh 80d46cee40 add Ethereum VM architecture 2018-03-31 00:08:28 +08:00
Nguyen Anh Quynh 40c477a79d update bindings to add KS_OPT_SYM_RESOLVER. Python binding now supports this option. see sample.py for example 2016-10-02 13:56:10 +08:00
Nguyen Anh Quynh 0c56ef96eb bindings: support RADIX16 syntax added to the core in the last commit 2016-09-10 02:05:57 +08:00
Nguyen Anh Quynh 8b7ca00c50 x86: fix issue #168 2016-06-05 15:06:04 +08:00
Nguyen Anh Quynh 070b5add69 x86: fix crash-21-x64-llvm-error-expected-absolute-expression.c 2016-05-31 15:08:32 +08:00
Nguyen Anh Quynh 4d2353952b down version to 0.9 for public release 2016-05-31 09:26:37 +08:00
Nguyen Anh Quynh 499f78265e handle error in peekTok(). this fixes c-crashes/crash-04-hexagon-readcount-not-equal-to-one.c 2016-05-31 00:43:35 +08:00
Nguyen Anh Quynh 7e3e187c90 bindings: udpate 2016-05-30 22:36:08 +08:00
Remco b2996ada87 rustfmt'd rust binding 2016-05-30 13:56:18 +02:00
Remco a89d283518 added nodejs makefile, updated all bindings, updated const generator for nodejs, ruby and python 2016-05-30 13:30:29 +02:00
Remco d5866a4af0 fixed rust bindings 2016-05-30 13:16:44 +02:00
Remco de820291bc working on rust bindings 2016-05-30 13:16:44 +02:00
Remco 71d98060fe added rust binding 2016-05-30 13:16:44 +02:00