[example_plugin] Changed to example_plugin to hook into FS_INIT

- Using the init hook
This commit is contained in:
Maschell 2018-02-10 17:05:32 +01:00
parent ec217c6aef
commit 9ebad4be5d
2 changed files with 8 additions and 9 deletions

View File

@ -67,7 +67,7 @@ OBJDUMP := $(PREFIX)objdump
# --gc-sections: remove unneeded symbols # --gc-sections: remove unneeded symbols
# -T: use the linker script specified (to force certain wups sections together) # -T: use the linker script specified (to force certain wups sections together)
# -Map: generate a map file # -Map: generate a map file
LDFLAGS += --relocatable -s --gc-sections -u wups_load -u wups_meta \ LDFLAGS += --relocatable -s --gc-sections -u wups_load -u wups_meta -u wups_hooks \
-T $(WUPSDIR)/wups.ld \ -T $(WUPSDIR)/wups.ld \
$(patsubst %,-Map %,$(strip $(MAP))) -wrap malloc -wrap free -wrap memalign -wrap calloc -wrap realloc -wrap malloc_usable_size -wrap _malloc_r -wrap _free_r -wrap _realloc_r -wrap _calloc_r -wrap _memalign_r -wrap _malloc_usable_size_r $(patsubst %,-Map %,$(strip $(MAP))) -wrap malloc -wrap free -wrap memalign -wrap calloc -wrap realloc -wrap malloc_usable_size -wrap _malloc_r -wrap _free_r -wrap _realloc_r -wrap _calloc_r -wrap _memalign_r -wrap _malloc_usable_size_r
LD1FLAGS += --relocatable -s \ LD1FLAGS += --relocatable -s \

View File

@ -5,24 +5,23 @@
#include "dynamic_libs/socket_functions.h" #include "dynamic_libs/socket_functions.h"
#include "utils/logger.h" #include "utils/logger.h"
WUPS_MODULE_NAME("test module"); WUPS_MODULE_NAME("test module");
WUPS_MODULE_VERSION("v1.0"); WUPS_MODULE_VERSION("v1.0");
WUPS_MODULE_AUTHOR("Maschell"); WUPS_MODULE_AUTHOR("Maschell");
WUPS_MODULE_LICENSE("BSD"); WUPS_MODULE_LICENSE("BSD");
DECL_FUNCTION(void,OSFatal,char * msg){ INITIALIZE(){
InitOSFunctionPointers(); InitOSFunctionPointers();
InitSocketFunctionPointers(); InitSocketFunctionPointers();
log_init(); log_init();
//log_printf is not working. log_print("Init of example_plugin!\n");
log_print(msg); }
log_print("\n^--- Someone called OSFatal with this string. Lets modify it. Bye bye =(\n"); DECL_FUNCTION(int,FSInit,void){
real_OSFatal("Does the replacement work?"); log_print("FSInit called\n");
return; return real_FSInit();
} }
WUPS_MUST_REPLACE(OSFatal,WUPS_LOADER_LIBRARY_COREINIT, OSFatal); WUPS_MUST_REPLACE(FSInit,WUPS_LOADER_LIBRARY_COREINIT, FSInit);