inman has asked for the wisdom of the Perl Monks concerning the following question:

I am working with a vendor API that is available in either C or Java and is used to administer a set of services. Using the C API, I have written a number of small command line applications that I run from Perl test scripts to determine the state of the service, restart it etc. This has worked well enough but now I want to drive the C code direcly from the Perl test scripts.

My plan is to take only the functionality that I need and to build and maintain a C DLL and then run h2xs against the header to produce the Perl module. Once the compiler project is set up, I can keep the C libary up to date by adding functionality when the need arises and simply generate the latest module.

I would like to know whether any monk has produced (or knows about) an easy to follow example which will get me started. It would also be great if I could get advice on the best practice for writing C code such that h2xs had minimum of problems. I have been looking at the perlxs and perlxstut documentation in addition to the h2xs documentation but I really want a worked example to start me off. Laziness or intelligent re-use: you decide!

Replies are listed 'Best First'.
Re: Wanted: Idiots guide to h2xs
by derby (Abbot) on Jan 19, 2004 at 15:06 UTC