neelance / ffi_gen

A generator for Ruby FFI bindings, directly from header files via LLVM's Clang compiler
MIT License
88 stars 26 forks source link

Structure with pragma_pack. #15

Closed novogrammer closed 12 years ago

novogrammer commented 12 years ago

I wrote packed_at method. Because, clang can not seem to understand the pragma_pack.

neelance commented 12 years ago

Can you show me an example? Maybe you can include the library you are trying to process in the tests. That way, your features would be protected from being broken by future changes.

novogrammer commented 12 years ago

I want to process binary struct, written in C.(It is not Open Source..)

And, I could not find an open source library ,that is using the pragma_pack. pragma_pack is usually used with MSVC.

see my test code: https://github.com/novogrammer/ffi_gen/blob/master/test/header/pragma_pack.h

dsisnero commented 12 years ago

I was trying to generate bindings for ole on windows and it needs pragma_pack functionality

DevKit/tdm-32-4.6.1/mingw/include/ole2.h:#pragma pack(push,8) DevKit/tdm-32-4.6.1/mingw/include/ole2.h:#pragma pack(pop) DevKit/tdm-32-4.6.1/mingw/include/oleauto.h:#pragma pack(push,8) DevKit/tdm-32-4.6.1/mingw/include/oleauto.h:#pragma pack(pop) DevKit/tdm-32-4.6.1/mingw/include/olectl.h:#pragma pack(push,8) DevKit/tdm-32-4.6.1/mingw/include/olectl.h:#pragma pack(pop) DevKit/tdm-32-4.6.1/mingw/include/oledlg.h:#pragma pack(push, 8) DevKit/tdm-32-4.6.1/mingw/include/oledlg.h:#pragma pack(pop) DevKit/tdm-32-4.6.1/mingw/include/poppack.h:#pragma pack(pop)

novogrammer commented 12 years ago

My "packed_at" cannot process "#include" like below. Need to improve...

include "pshpack4.h"

struct Foo { };

include "poppack.h"

novogrammer commented 12 years ago

I close pull request. Because it is not for general use.