diff options
Diffstat (limited to 'gfsm/gfsm/src/libgfsm/tests/module')
-rw-r--r-- | gfsm/gfsm/src/libgfsm/tests/module/.cvsignore | 18 | ||||
-rw-r--r-- | gfsm/gfsm/src/libgfsm/tests/module/Makefile | 39 | ||||
-rw-r--r-- | gfsm/gfsm/src/libgfsm/tests/module/mod1a.c | 5 | ||||
-rw-r--r-- | gfsm/gfsm/src/libgfsm/tests/module/mod1b.c | 5 | ||||
-rw-r--r-- | gfsm/gfsm/src/libgfsm/tests/module/mod1test.c | 52 |
5 files changed, 0 insertions, 119 deletions
diff --git a/gfsm/gfsm/src/libgfsm/tests/module/.cvsignore b/gfsm/gfsm/src/libgfsm/tests/module/.cvsignore deleted file mode 100644 index 58d248b..0000000 --- a/gfsm/gfsm/src/libgfsm/tests/module/.cvsignore +++ /dev/null @@ -1,18 +0,0 @@ -*~ -.*~ - -*.gfst -*.output -*.lex.c -*.lex.h -*.tab.c -*.tab.h -*.gz -*.so -*.o - -tagh* -*.dat -negra* - -mod1test diff --git a/gfsm/gfsm/src/libgfsm/tests/module/Makefile b/gfsm/gfsm/src/libgfsm/tests/module/Makefile deleted file mode 100644 index c310837..0000000 --- a/gfsm/gfsm/src/libgfsm/tests/module/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -TARGETS = mod1test libmod1a.so libmod1b.so -KNOWN_TARGETS = mod1test libmod1a.so libmod1b.so - -CC = gcc -#CC = ccmalloc --no-wrapper gcc -LD = $(CC) - -CPPFLAGS = $(shell pkg-config --cflags-only-I gmodule-2.0) -#CFLAGS ?= -O2 -pipe -#CFLAGS ?= -Wall -g -#CFLAGS += -Wall -g -CFLAGS ?= -g -CFLAGS += -Wall -fPIC -DPIC - -LDFLAGS = $(shell pkg-config --libs-only-L gmodule-2.0) -LIBS = $(shell pkg-config --libs-only-l gmodule-2.0) -lm - -LDFLAGS_MODULE = -shared $(LDFLAGS) - -all: $(TARGETS) - -##-- keep intermediate files -.SECONDARY: - -##-- PATTERN: .c -> .o -%.o: %.c - $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $< - -##-- clean -clean: - rm -f *.o *.lo *.tab.[ch] *.lex.[ch] $(KNOWN_TARGETS) - -##-- modules -lib%.so: %.o - $(LD) $(LDFLAGS_MODULE) -o $@ $^ $(LIBS) - -##-- Executables -%test: %test.o - $(LD) $(LDFLAGS) -o $@ $^ $(LIBS) diff --git a/gfsm/gfsm/src/libgfsm/tests/module/mod1a.c b/gfsm/gfsm/src/libgfsm/tests/module/mod1a.c deleted file mode 100644 index 69674c5..0000000 --- a/gfsm/gfsm/src/libgfsm/tests/module/mod1a.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <stdio.h> - -void foo(void) { - printf("mod1a:foo() called.\n"); -} diff --git a/gfsm/gfsm/src/libgfsm/tests/module/mod1b.c b/gfsm/gfsm/src/libgfsm/tests/module/mod1b.c deleted file mode 100644 index 4705f7c..0000000 --- a/gfsm/gfsm/src/libgfsm/tests/module/mod1b.c +++ /dev/null @@ -1,5 +0,0 @@ -#include <stdio.h> - -void foo(void) { - printf("mod1b:foo() called.\n"); -} diff --git a/gfsm/gfsm/src/libgfsm/tests/module/mod1test.c b/gfsm/gfsm/src/libgfsm/tests/module/mod1test.c deleted file mode 100644 index 6389972..0000000 --- a/gfsm/gfsm/src/libgfsm/tests/module/mod1test.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <stdio.h> -#include <glib.h> -#include <gmodule.h> - -typedef void (*fooFunc) (void); - -int main(int argc, char **argv) { - int i; - const gchar *prog = argv[0]; - //const gchar *moddir = g_getenv("PWD"); //-- get module directory (hack) - const gchar *moddir = "."; - gchar *modpath; - GModule *mod; - fooFunc foofunc; - - g_assert(g_module_supported()); - - for (i=1; i < argc; i++) { - //-- build full module pathname - modpath = g_module_build_path(moddir,argv[i]); - printf("%s: argv[%d]='%s': moddir='%s', modpath='%s'\n", prog, i, moddir, argv[i], modpath); - //-- - //modpath = argv[i]; - //printf("%s: argv[%d]='%s': modfile='%s'\n", prog, i, argv[i], modpath); - - //-- open module - if ( !(mod = g_module_open(modpath,G_MODULE_BIND_LOCAL)) ) { - g_printerr("%s: could not load module '%s': %s - skipping\n", prog, modpath, g_module_error()); - if (modpath != argv[i]) g_free(modpath); - continue; - } - printf("-> open(): %p\n", mod); - - //-- get symbol 'foo' from module - if (!g_module_symbol(mod,"foo",(gpointer *)&foofunc)) { - g_printerr("%s: could not load symbol 'foo' from module '%s': %s\n", prog, modpath, g_module_error()); - g_module_close(mod); - if (modpath != argv[i]) g_free(modpath); - continue; - } - printf("-> symbol('foo'): %p\n", foofunc); - - //-- call 'foo' as a foofunc - printf("-> calling foo(): "); - foofunc(); - - //-- cleanup - if (modpath != argv[i]) g_free(modpath); - g_module_close(mod); - } - return 0; -} |