[−][src]Function mcl::init::mcl_bn_init
pub fn mcl_bn_init(curve: i32, compiled_time_var: i32) -> i32
Initialize the MCL library.
This function MUST be called before you perform any operation on any type from MCL.
This function is a synchronized wrapper of mclBn_init
. If you forget to call
the underlying function directly or via this wrapper, you'll run into very
weird and hard to debug memory bugs.
This function can be safely called by multiple threads and multiple times,
because the current implementation uses std::sync::Once
to assure
the FFI endpoint is called only once.
This also means that at the moment you can't change the elliptic curve using
this method by calling it again. For now, the best solution is to unsafely
call the FFI endpoint mclBn_init
and pass all the necessary parameters.
Note
You probably shouldn't call this function unless init_curve
doesn't implement
the elliptic curve you need.
Examples
use mcl::init::mcl_bn_init; mcl_bn_init(5, 46); // parameters of BLS12_381