Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -1,9 +1,9 @@ -CPPFLAGS := -I. -DUSE_TCL_STUBS=1 -DXVFS_MODE_STANDALONE +CPPFLAGS := -I. -DUSE_TCL_STUBS=1 -DXVFS_MODE_FLEXIBLE CFLAGS := -fPIC -g3 -ggdb3 -Wall LDFLAGS := -LIBS := -ltclstub8.6 +LIBS := -ltclstub8.6 -ldl all: example.so example.c: $(shell find example -type f) $(shell find lib -type f) xvfs.c.rvt xvfs-create Makefile ./xvfs-create --directory example --name example > example.c.new Index: xvfs-core.c ================================================================== --- xvfs-core.c +++ xvfs-core.c @@ -77,11 +77,11 @@ return(NULL); } #endif /* XVFS_MODE_SERVER || XVFS_MODE_STANDALONE || XVFS_MODE_FLEIXBLE */ -#if defined(XVFS_MODE_STANDALONE) +#if defined(XVFS_MODE_STANDALONE) || defined(XVFS_MODE_FLEXIBLE) /* * Tcl_Filesystem handlers for the standalone implementation */ static struct xvfs_tclfs_instance_info xvfs_tclfs_standalone_info; static int xvfs_tclfs_standalone_pathInFilesystem(Tcl_Obj *path, ClientData *dataPtr) { @@ -191,11 +191,28 @@ } return(TCL_OK); } #endif + +#if defined(XVFS_MODE_FLEXIBLE) +#include +int xvfs_flexible_register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) { + int (*xvfs_register)(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) = NULL; + + /* + * XXX:TODO: Find some way to use Tcl_FindSymbol() to do this + */ + xvfs_register = dlsym(NULL, "Xvfs_Register"); + if (!xvfs_register) { + xvfs_register = &xvfs_standalone_register; + } + + return(xvfs_register(interp, fsInfo)); +} +#endif #if defined(XVFS_MODE_SERVER) int Xvfs_Register(Tcl_Interp *interp, struct Xvfs_FSInfo *fsInfo) { return(TCL_ERROR); } #endif