Subject: Re: [ruby-ffi] Re: Automatic Struct Layout |
From: Evan Phoenix |
Date: 12/18/09 12:13 PM |
To: ruby-ffi@googlegroups.com |
On Dec 18, 2009, at 10:04 AM, rogerdpack wrote:
It does, the wiki just hasn't been updated ... in about a year - so feel free to fix it up.Cool, thanks.That will calculate the offset of :b automatically for you, and take into account 32bit vs 64bit, minimum alignments, tail padding, etc.Question How does ffi deal with #pragma pack in msvc?
It does not. It uses some basic rules that work in most cases. If these rules don't work for your struct, you need to specify the offsets manually. - Evan
ex: gc.c:#pragma pack(push, 1) /* magic for reducing sizeof(RVALUE): 24 -> 20 */ Just wondering. Thanks. -r