I include a makefile to compile a C++ written module. In addition: 1) init_module() and cleanup_module() have to be prefixed with extern "C" to avoid name mangling problems. 2) All kernel includes and declarations have to be bracketed with #ifdef __cplusplus extern "C" { #endif #include <kernel_stuff> #ifdef __cplusplus } #endif It works fine here using gcc 2.8.1 - I have not tried any other compiler. Regards -------------------------- - POSEIDON CONTROLS INC - - Phone: (450)-659-9186 - - Fax: (450)-659-0014 -
OBJS = mod.o pamux.o TARGET = rtl_pamux.o # compiler CXX = g++ CFLAGS = -I/usr/src/linux/include -I/usr/src/rtl/include \ -Wall -Wstrict-prototypes -fomit-frame-pointer \ -fno-exceptions -fno-rtti -fno-builtin \ -mhard-float -fno-strength-reduce # linker LD = /usr/i586-linux-libc6/bin/ld LDFLAGS = -nostdlib -r -static LDLIBS = all : rtl_pamux.o pamux.o : pamux.cc pamux.hh pamuxint.hh $(CXX) $(CFLAGS) -c -o $@ $< mod.o: mod.cc pamux.hh pamuxint.hh $(CXX) $(CFLAGS) -c -o $@ $< $(TARGET) : $(OBJS) $(LD) $(LDFLAGS) -o $@ $(OBJS) clean: rm -f *.o rtl: insmod ../modules/rtl_sched.o test: sync insmod rtl_pamux.o