The name isn't great, the available thunks are too few, the known types are too simple, and it has a tendency to rebuild the C files every time you call ./Build, but P5NCI version 0.01 works and you're more than welcome to try it and send me patches.
Alternately, tell me how cool P5NCI::Library actually is in practice.
Thanks to jplindstrom for pointing me at Win32::API which already handles structs; I think I can modify that code to work on other platforms. What's a little sizeof between friends?
Thanks to jplindstrom for pointing me at Win32::API which already handles structs; I think I can modify that code to work on other platforms. What's a little sizeof between friends?
What I don't like about the way Win32::API handles structs is that it forces you to write the spec for each struct manually.
You probably also want to have a look at Convert::Binary::C, which allows for directly parsing C header files and using that information to pack/unpack binary data. It comes with a fully integrated C preprocessor, isn't limited to structs (handles unions, arrays, typedefs as well, and all of them recursively), and is highly configurable. It also has methods like sizeof or offsetof, and over 100k of POD. (end of ad...
I had something similar to P5NCI on my mind, probably based on libffi, and I think it's definitely useful. Nice work!