I'm with jethro, if you feel the need to use Pastebin and what-not to get help you appear to be having problems isolating the place where your code is having trouble. In other words, you are more likely to get help if you are more specific with the description of your error.
Before doing anything however, why can't the C code compile on Solaris (I don't have a Solaris VM or machine handy to answer the question for myself)? My thoughts are that if you could get it to compile then you could write an XS module from Perl to just use the functions you need. From a performance standpoint I cannot imagine how this would not be your best choice. Heck, even if the C code breaks it may be better to fix it and then follow the XS route rather than do this in Pure Perl.
Celebrate Intellectual Diversity