Extern static in dll has incorrect address

I have two rust crates, one of which is a cdylib crate and the other has a load-time dependency on the cdylib. I've defined a #[no_mangle] static in the cdylib, and when i try to access it from the main crate, the address of the static is incorrect, so i can't use the static at all.

Main crate

unsafe extern "C" {
	pub safe fn print_static();
	pub safe static VALUE: i32;
}

fn main() {
	print_static();
	println!("{:?}", &VALUE as *const _);
	println!("{:?}", VALUE);
}

dylib crate

#[unsafe(no_mangle)]
static VALUE : i32 = 25;

#[unsafe(no_mangle)]
pub extern "C" fn print_static() {
	println!("{:?}", &VALUE as *const _);
	println!("{:?}", VALUE);
}

when i print the address and value of the static in both the main and dll crate, i get an output like this

0x7ffe64a892a0
25
0x7ff601477646
745809407

Why is the address of the static in the main crate incorrect? Is this even something I'm allowed to do with a dll?

Depends on your platform.

Should work fine on Linux, since ELF went to great pains to make that usecase supported.

Wouldn't work on Windows since that platform started with Windows16 where DLL-specific variables were shared between processes for efficiency and even on Windows64 you still have remnants from that era.

Not sure about macOS.