#What's the best way to handle c structs with ifdefs inside?

1 messages · Page 1 of 1 (latest)

hidden ice
#

Hi, I'm working on some C bindings for a library and I was wondering. What's the ideal way to use these type of structs?

struct data {
  ...
#if defined(SOMETHING1)
  ...
#endif
  ...
#if defined(SOMETHING2)
  ...
#endif
  ...
#if defined(SOMETHING3)
  ...
#endif
}; 

my idea would be to put them all in a .h header file and try to import that but it feels a bit hacky. Is there a better way to deal with them?

swift stratus
#

field: if (something) SomeType else void

hidden ice
#

Thanks!!

#

Another quick question, how can i pass this something variable using build.zig? Do I need to create files with these variables set?