Hi,
I'm trying to write a wrapper for a c library (libjit) for a JIT compiler and I struggle with the following.
There's a struct jit_type_t
defined without any hints about its structure, so I'm guessing it's an opaque type.
There are also constants of this type defined like this: (in C)
extern jit_type_t const jit_type_int;
extern jit_type_t const jit_type_long; // and so on...
I wrote the type definition in Rust as following (based on the manual):
#[repr(C)] pub struct jit_type_t { _private: [u8; 0] }
And then tried to 'import' the constant definitions:
#[link(name = "jit", kind = "static")]
extern "C" {
pub static jit_type_int: jit_type_t;
}
I'm not sure if the import even works in the first place, because when I try to use it the compiler fails with error "move occurs because jit_type_int
has type jit_type_t
, which does not implement the Copy
trait".
How to proceed with this?