Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions rustler/src/codegen_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,15 @@ where
}
}
}

pub const fn min_erts() -> &'static [u8] {
if cfg!(feature = "nif_version_2_17") {
b"OTP-26.0\0"
} else if cfg!(feature = "nif_version_2_16") {
b"OTP-24.0\0"
} else if cfg!(feature = "nif_version_2_15") {
b"OTP-22.0\0"
} else {
b"OTP-21.0\0"
}
}
1 change: 1 addition & 0 deletions rustler/src/sys/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ pub struct ErlNifEntry {
pub vm_variant: *const c_char,
pub options: c_uint, // added in 2.7
pub sizeof_ErlNifResourceTypeInit: usize, // added in 2.12
pub min_erts: *const c_char, // added in 2.14
}

pub const ERL_NIF_DIRTY_NIF_OPTION: c_uint = 1;
Expand Down
1 change: 1 addition & 0 deletions rustler_codegen/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl From<InitMacroInput> for proc_macro2::TokenStream {
vm_variant: b"beam.vanilla\0".as_ptr() as *const rustler::codegen_runtime::c_char,
options: 0,
sizeof_ErlNifResourceTypeInit: rustler::codegen_runtime::get_nif_resource_type_init_size(),
min_erts: rustler::codegen_runtime::min_erts().as_ptr() as *const rustler::codegen_runtime::c_char,
};

unsafe {
Expand Down
Loading