Host pointer width in derive macro

I'm trying to find the usize size (or pointer width) on my host (vs. build system) from within a derive macro
A simple call to size_of gives the size on the build system, which makes sense since that is where the macro runs
Using the CARGO_CFG_TARGET_POINTER_WIDTH env variable would have been ideal but it's unfortunately not set when the macro runs
Is there another way?

I don't know how the env variables, but maybe you could just emit a call to ::core::mem::size_of::<usize>() from your macro and let it get evaluated later.

1 Like

It requires some modifications in my macros but it's going to work very well, thx :slight_smile:
I'm keeping this open in case there's another way where the size is resolved at build time