WUPS 0.7 - Add __init and __fini wrapper

This commit is contained in:
Maschell 2022-01-22 13:18:31 +01:00
parent 79160a0747
commit 9d41a89c45
3 changed files with 22 additions and 3 deletions

View File

@ -2,8 +2,8 @@ TOPDIR ?= $(CURDIR)
include $(TOPDIR)/share/wups_rules include $(TOPDIR)/share/wups_rules
export WUT_MAJOR := 0 export WUT_MAJOR := 0
export WUT_MINOR := 6 export WUT_MINOR := 7
export WUT_PATCH := 1 export WUT_PATCH := 0
VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH) VERSION := $(WUT_MAJOR).$(WUT_MINOR).$(WUT_PATCH)

View File

@ -42,6 +42,9 @@ typedef enum wups_loader_hook_type_t {
WUPS_LOADER_HOOK_INIT_WUT_SOCKETS, WUPS_LOADER_HOOK_INIT_WUT_SOCKETS,
WUPS_LOADER_HOOK_FINI_WUT_SOCKETS, WUPS_LOADER_HOOK_FINI_WUT_SOCKETS,
WUPS_LOADER_HOOK_INIT_WRAPPER, /* Calls __init */
WUPS_LOADER_HOOK_FINI_WRAPPER, /* Calls __fini */
WUPS_LOADER_HOOK_GET_CONFIG, WUPS_LOADER_HOOK_GET_CONFIG,
WUPS_LOADER_HOOK_CONFIG_CLOSED, WUPS_LOADER_HOOK_CONFIG_CLOSED,
@ -174,6 +177,20 @@ typedef struct wups_loader_hook_t {
}\ }\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_STDCPP,on_fini_wut_stdcpp) WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WUT_STDCPP,on_fini_wut_stdcpp)
#define WUPS___INIT_WRAPPER() \
__EXTERN_C_MACRO void __init(); \
void __init_wrapper(){ \
__init(); \
}\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_INIT_WRAPPER,__init_wrapper);
#define WUPS___FINI_WRAPPER() \
__EXTERN_C_MACRO void __fini(); \
void __fini_wrapper(){ \
__fini(); \
}\
WUPS_HOOK_EX(WUPS_LOADER_HOOK_FINI_WRAPPER,__fini_wrapper);
#define WUPS_USE_WUT_SOCKETS() \ #define WUPS_USE_WUT_SOCKETS() \
__EXTERN_C_MACRO void __attribute__((weak)) __init_wut_socket(); \ __EXTERN_C_MACRO void __attribute__((weak)) __init_wut_socket(); \
void on_init_wut_sockets(){ \ void on_init_wut_sockets(){ \

View File

@ -33,11 +33,13 @@ extern "C" {
#endif #endif
#define WUPS_PLUGIN_NAME(x) WUPS_META(name, x); \ #define WUPS_PLUGIN_NAME(x) WUPS_META(name, x); \
WUPS_META(wups, "0.6.1"); \ WUPS_META(wups, "0.7.0"); \
WUPS_USE_WUT_MALLOC(); \ WUPS_USE_WUT_MALLOC(); \
WUPS_USE_WUT_SOCKETS(); \ WUPS_USE_WUT_SOCKETS(); \
WUPS_USE_WUT_NEWLIB(); \ WUPS_USE_WUT_NEWLIB(); \
WUPS_USE_WUT_STDCPP(); \ WUPS_USE_WUT_STDCPP(); \
WUPS___INIT_WRAPPER(); \
WUPS___FINI_WRAPPER(); \
WUPS_META(buildtimestamp, __DATE__ " " __TIME__); WUPS_META(buildtimestamp, __DATE__ " " __TIME__);
#define WUPS_PLUGIN_AUTHOR(x) WUPS_META(author, x) #define WUPS_PLUGIN_AUTHOR(x) WUPS_META(author, x)