Open bogen85 opened 3 years ago
In general clang2py does not like the headers I give it. I was trying to use cffi on some headers and it did not them either. The following made them more palatable, and clang2py likes headers resulting from this as well:
result = subprocess.check_output(f"clang -E -I. {header}", shell=True)
sanitized = []
for line in result.decode(encoding='utf-8').split('\n'):
for bad in ['__asm__', '__attribute__']:
if bad in line:
line = f'{line.split(bad)[0]};'.replace(';;',';')
sanitized.append(line)
lines = "\n".join(sanitized)
With sanitized headers and the above sed commands I'm having a lot more success with ctypeslib than I was having with cffi I'm passing in my library and getting most symbols resolved by it. When I try to pass in libc.so.6 as well, I get no output from clang2py, but that is a different issue.
Well, actually I'm fixing it all up in python now, the sed stuff was just temporary from the command line to get it working.
Sounds like clang2py would need a conflicting names resolver?
Since that is a python keyword, loading the resulting file is problematic....
I was able to fix and a few other issues with: