`init` macro does not work
chmllr opened this issue · comments
Christian Müller commented
I have a function annotated as follows:
#[ic_cdk_macros::init]
fn init() {
unsafe {
SOME_MAP = Some(HashMap::new());
}
}
This code compiles and can be deployed to the local replica, however the global variable stays uninitialized. When I change ic_cdk_macros::init
to ic_cdk_macros::update
and call init
explicitly, everything works as expected and the variable is initialized. Hence I conclude that the init
macro has no effect for some reason.
$ dfx --version
dfx 0.7.0-beta.1