top | item 38685259

(no title)

raoulj | 2 years ago

I've done this where I use python's ctypes library to write tests for a c codebase. This feels very similar in that it can be tricky to get the type interop correct the first time around. What other strategies/solutions do people like to use for testing their c projects?

discuss

order

fredyr|2 years ago

I've done a lot of CFFI with Python for this kind of testing in the past. But nowadays I'm also looking at Zig for this.

pastage|2 years ago

Has the way Python handles this changed a lot in the last decades? I have never did it because I feared having to chase changes in Python and an ever changing build environment. Mostly a focus thing I knew I alone would not be the one to fix it across all build envs. At the time I was the lone Pythonista now everyone we hire is comfortable with Python so I made the wrong choice.

physPop|2 years ago

the point of zig is that there is no FFI to get right

ColonelPhantom|2 years ago

I think (but I'm not sure) that in Zig you can just @cInclude("header.h") or something like that? So your C types are automatically imported/converted to Zig types.