diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -44,13 +44,16 @@ get_string = ffi.string def get_library(): fp = 'NK_C_API.h' # path to C API header - declarations = [] + declarations = [] with open(fp, 'r') as f: declarations = f.readlines() - for declaration in declarations: - if 'extern' in declaration and not '"C"' in declaration: + a = iter(declarations) + for declaration in a: + if declaration.startswith('extern') and not '"C"' in declaration: declaration = declaration.replace('extern', '').strip() + while not ';' in declaration: + declaration += (next(a)).strip() # print(declaration) ffi.cdef(declaration) |