Skip to content

Commit

Permalink
Fix #30
Browse files Browse the repository at this point in the history
  • Loading branch information
trolldbois committed Jun 2, 2017
1 parent e3e2f29 commit ca02751
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,45 @@ __all__ = \
['struct_my_bitfield']
```

Other example with headers:

Source file:
```
$ cat test-stdbool.c
#include <stdbool.h>
typedef struct s_foo {
bool bar1;
bool bar2;
bool bar3;
} foo;
```
Run c-to-python script (with any relevant include folder):
`clang2py --clang-args="-I/usr/include/clang/4.0/include" test-stdbool.c`
Output:
```
# -*- coding: utf-8 -*-
#
# TARGET arch is: ['-I/usr/include/clang/4.0/include']
# WORD_SIZE is: 8
# POINTER_SIZE is: 8
# LONGDOUBLE_SIZE is: 16
#
import ctypes
class struct_s_foo(ctypes.Structure):
_pack_ = True # source:False
_fields_ = [
('bar1', ctypes.c_bool),
('bar2', ctypes.c_bool),
('bar3', ctypes.c_bool),
]
foo = struct_s_foo
__all__ = \
['struct_s_foo', 'foo']
```




Expand Down

0 comments on commit ca02751

Please sign in to comment.