Are you aware of SWIG?

From: Date: Fri, 17 May 2002 10:30:28 +0000
Subject: Are you aware of SWIG?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-1397@lists.php.net to get a copy of this message
I thought it may be useful to keep you up to date on SWIG. (www.swig.org) Swig, given any C or C++ library with header files and an optional swig interface file can generate modules for PHP, Perl, Python, Java, Guile etc etc. I've done a lot of work on swig-php (in cvs) in conjunction with earlier work done by Richard Palmer and consider it very useful for generating php modules. It has the ability to wrap C++ classes and C structs as native PHP objects if required It no longer uses PHP-coded shadow classes but C-coded PHP shadow classes. Return swig values are now PHP resources and not ghastly swig-pointer-strings. It also has the ability to autmatically generate config.m4 and Makefile.in for C or C++ modules so that the output of SWIG is enough that only PHPIZE needs running before compiling the new php module. To generate a complete PHP module from an installed library I just have to do: # swig -c++ -php4 -phpfull -withlibs "xapian omqueryparser" \ -withincs om/om.h -shadow \ -o xapian/xapian_wrap.cpp ../swig/xapian.i # cd xapian && phpize && ./configure && make && make install I'm developing in for use by the xapian search engine system (www.xapian.org) which is based on the open-sourced commercial SmartLogik product. Anyway, as PEAR can include C modules I was wondering if some of the rules could be relaxed regarding coding standards. By this I mean the "code" for a SWIG'd C module for PHP really consists just of the special swig .i file; the C/C++ code generated may not be pretty to look at. Comments? Sam

« previous php.pear.general (#1397) next »