4 May 2004 19:18
Is SWIG appropriate
David Cannings <lists <at> edeca.net>
2004-05-04 17:18:10 GMT
2004-05-04 17:18:10 GMT
I am no great programmer in either C or Perl but am trying to convert a C
header file into a Perl module. I have one that was made by somebody
else using an old version of h2xs and old versions of the header files
but now want to update it and document it properly. The header files are
from the MTA Exim and I want to be able to call certain functions from
the C file from Perl.
I have tried using h2xs to convert the header file without success so have
given up trying to use it. Its behaviour isn't consistent with the
manual page and there are bugs in perlbug that are three years old
relating to my problems. I get no response from Perl mailing lists
either, because of this I found SWIG.
The defines a number of functions, an enum and some other variables such
as "extern uschar *message_id". I decided to start small and get one
method working so have created myself a file called LocalScan.i that
contains:
-- File: LocalScan.i --
%module LocalScan
%{
/* Includes the header in the wrapper code */
#include "local_scan.h"
%}
/* Parse the header file to generate wrappers */
extern void header_add(int, char *, ...);
-- End file --
(Continue reading)
RSS Feed