OV
Change the struct size based on current architecture
Hi, I'm working on porting a C library to C# that contains architecture-dependent structs. Here's my C code:
the problem is that my struct has conditional fields that only exist in 64-bit builds. In C, this is handled with #ifdef Is64BitEnviroment, but I need a C# equivalent that works with "Any CPU" configuration.
i tried to copy some runtime code on the same topic. which was the Intptr struct. but it did not work. for my 64 bit windows pc with Any Cpu configuration. it produce the 32 bit (x86) code .
How can I define a C# struct that correctly matches this architecture-dependent C struct when compiling with "Any CPU"?
102 replies