On Thu, 1 Jul 2004, Anil Madhavapeddy wrote: AM>On 1 Jul 2004, at 13:48, Roman Kurakin wrote: AM>> AM>> If this is a problem why can't you make some wrapper that will pack/unpack AM>> written on C, AM>> which will be a lib for you? AM> AM>Because I want to minimise the size of the foreign bindings - this would AM>require C code for every single Netgraph struct. If they were packed, I AM>could just do it all in OCaml. AM> AM>Isn't this a problem for other language bindings as well, or is everyone AM>doing Netgraph userland hacking in C at the moment?
Packing structs is a evil thing to do because this requires non-standard compiler support. Traditionally this was done with carefully designing the struct and inserting explicit spare fields where the compiler would pad. Unfortunately with decreasing $/bit for memory this knowledge has been lost and in any case it helps only for a concrete compiler/platform combination. So why can't you just guess the padding and handle it explicitely? Have a look at ng_parse.c. harti _______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to "[EMAIL PROTECTED]"