You are welcome
I had similar problems converting libnds for fpc. It was a real nightmare, because I had to check all those functions for type conversions, value by value, one by one, comparing the results from c and pascal code, and testing it on an emulator and on real hardware