Parrot-GMP: NCI Thunk generation complete

Just a small re-cap from my last post - not every possible function signature that you might want to call through NCI comes built into Parrot. When you try to invoke a function that does not have a generated NCI thunk you will get a run-time error. GMP had a number of functions that were not covered by the built in NCI thunks so I installed libffi to get around this problem. Jay++ and dukeleteo++ have both started projects that will use NCI to some extent and are running into this problem as well. So I decided to tackle how to get around this problem without requiring libffi.

Parrot comes with an installed script called parrot_nci_thunk_gen - it takes an NCI definition file and outputs C code that can be compiled as a shared library and loaded with your code. The script takes an NCI definition file that is slightly different from the the kind that takes but more importantly it does not know which NCI thunks are already available in Parrot. So I wrote a small script, bin/, that reads my NCI definition file (the kind that is for and reads the two Parrot files that contain NCI information (src/nci/core_thunks.nci src/nci/extra_thunks.nci) and outputs an NCI definition file (formatted for parrot_nci_thunk_gen) with only those thunks which are necessary.

Then in my distutils setup.winxed I use information that is in Parrot's config hash to compile this C file into a shared library. It was a bit difficult to figure out exactly how to do this in a platform independent way but I believe what I now have will work for everybody.

I have begun documenting both how to use Parrot-GMP and how to build buildings to a C library using Parrot NCI and some of my tools. I hope this will make other projects less frustrating to program.