manuels / cxx2rs

A rust-binding generator for C files
GNU General Public License v2.0
51 stars 3 forks source link

Not implemented: Type=TypeKind.FUNCTIONNOPROTO #9

Closed emoon closed 9 years ago

emoon commented 9 years ago

Happens on this code

struct foo {
    float (*getBar)();
}

I call it like this:

cxx2rs foo test.h

Full output

 File "/usr/local/bin/cxx2rs", line 9, in <module>
    load_entry_point('cxx2rs==0.3.7', 'console_scripts', 'cxx2rs')()
  File "/Library/Python/2.7/site-packages/cxx2rs/__main__.py", line 60, in main
    print rustify_struct_declaration(struct)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 134, in rustify_struct_declaration
    members += "\tpub %s,\n" % rustify_variable_declaration(c)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 18, in rustify_variable_declaration
    rustify_type(node.type.get_canonical()))
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 88, in rustify_type
    res = rustify_pointer(node)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 49, in rustify_pointer
    return '*mut ' + rustify_type(canonical_pointee)
  File "/Library/Python/2.7/site-packages/cxx2rs/rustify.py", line 102, in rustify_type
    raise Exception("Not implemented: Type=%s" % canonical_kind)
Exception: Not implemented: Type=TypeKind.FUNCTIONNOPROTO

clang version

Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin15.0.0
Thread model: posix
manuels commented 9 years ago

Just fixed it! Give it a try.

emoon commented 9 years ago

That was fast :) Works great now. Thanks!