[Samba] VFS module and C++

Roman Bouchner roman.bouchner at gmail.com
Tue Feb 27 09:56:55 GMT 2007


Hi
I need to write a simple VFS module and I have to use C++ instead of C.
I took sample files, compiled it and everything does work. However, when
I compile it as C++, during the runtime I can see errors in the log:
Can't find a vfs module.
I am not experienced C or C++ programmer in linux environment, probably
I do some silly mistake, but I am really stucked now. I am using Samba
version 3.0.23a. Thanks for any help.
Roman

The fragment of the code looks like this:

extern "C" {
 #include "includes.h"
};

# skeleton methods, tuples are there...

extern "C" {
NTSTATUS init_module(void)
{
        DEBUG(2,("Inicialization does work"));
        return smb_register_vfs(SMB_VFS_INTERFACE_VERSION, "mytest_vfs",
skel_op_tuples);
}
};


And my Makefile:
CC              = gcc
CFLAGS          = -g -O2
CPPFLAGS        =
LDFLAGS         =
LDSHFLAGS       = -shared
INSTALLCMD      = /usr/bin/install -c
SAMBA_SOURCE    = ../../source
SHLIBEXT        = so
OBJEXT          = o
FLAGS           = $(CFLAGS) -Iinclude -I$(SAMBA_SOURCE)/include
-I$(SAMBA_SOURCE)/popt -I$(SAMBA_SOURCE)/smbwrapper  -I. $(CPPFLAGS)
-I$(SAMBA_SOURCE) -I/home/roman/ace/ACE_wrappers/TAO/tao -fPIC


prefix          = /usr/local/samba
libdir          = ${prefix}/lib

VFS_LIBDIR      = $(libdir)/vfs

# Auto target
default: $(patsubst %.cpp,%.$(SHLIBEXT),$(wildcard *.cpp))

# Pattern rules

%.$(SHLIBEXT): %.$(OBJEXT)
        @echo "Linking $@"
        @$(CC) $(LDSHFLAGS) $(LDFLAGS) -o $@ $<

%.$(OBJEXT): %.cpp
        @echo "Compiling $<"
        @$(CC) $(FLAGS) -c $<


install: default
        $(INSTALLCMD) -d $(VFS_LIBDIR)
        $(INSTALLCMD) -m 755 *.$(SHLIBEXT) $(VFS_LIBDIR)

# Misc targets
clean:
        rm -rf .libs
        rm -f core *~ *% *.bak *.o *.$(SHLIBEXT)

distclean: clean
        rm config.* Makefile



More information about the samba mailing list