The only example for the "new style" modules is in the changes file (I'll include it below). If you're planning on distributing the module, such as with monger, the new style isn't really a viable option. I think the wording in the changes file is somewhat misleading, as the new module style doesn't really replace the old style for one of the most common scenarios (distributing a module).
There's a stub "old style" module available; you just need to change a few fields in the makefile and edit the configure script.
SVN address:
http://wush.net/svn/hww3/trunk/pike_modules/SampleModule
Bill
-- CUT --
It's now suggested that you do not use the fairly complex 'pike internal' style of external modules (configure.in with AC_MODULE_INIT etc).
It's also no longer required that you have a configure script to use pike -x module.
Instead simply locate the include files using 'pike -x cflags', and convert .cmod to .c files using 'pike -x precompile'.
An example rather minimal 'pike -x module' compatible Makefile, without a configure script, using .cmod format files for a simple local module:
| CC=gcc | CFLAGS := -O9 -fweb -shared -Wall $(CFLAGS) $(shell $(PIKE) -x cflags) -g | LD=$(CC) -shared -lGL | | all: Spike.so | | install: Spike.so | cp $< $(MODULE_INSTALL_DIR) | | Spike.so: Spike.o | $(LD) -o Spike.so Spike.o $(LDFLAGS) | | Spike.o: Spike.c | | Spike.c: Spike.cmod | $(PIKE) -x precompile $< > $@
It's usually OK not to use pike -x module at all, but it will pass on a few extra variables to your make (and configure script):
PIKE: How to start the pike interpreter used running pike -x module MODULE_INSTALL_DIR: Where modules goes LOCAL_MODULE_PATH: Alternative (user local) module location
On Wed, 10 Jun 2009, Lance Dillon wrote:
Is there an example I should follow for the new style? Or just stick with the old style? I'm going to be writing a C module (not a cmod).