in reply to How to use C Libraries in Perl Script?

Follow all of those links above and read them carefully.   Start by building a library of the functions; a library that you want to call from either environment.   Then, make sure that you know how to successfully call them from C ... that is to say, Perl is not involved yet.   Next, use the procedures described above to create the necessary “wrapper” that is needed to allow the Perl environment to make the call.   Notice that this is another layer of software, mostly “automagically built.”   But you really need to be sure that you have the direct-from-“C” scenario fully debugged first, because problems in that simpler scenario will of course also directly impact the other scenario. If you let them be jumbled-up, in what is already unfamiliar to-you territory anyhow, it’s unnecessarily difficult to sort them out.

Another trick that I like to use is to pick a package from CPAN that I already know uses an external library.   Then, I go into CPAN and look at it.   Then, of course taking great care not to touch anything, I will look around at actual, known-to-be working examples (and corresponding test cases), all of which I know will be “right there.”   Sometimes, an example’s worth a thousand words of documentation.