mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-03-21 16:40:18 +00:00
Use fct attr used to preserve key_control syms
This prevents them from being removed by linker with the modular build.
This commit is contained in:
@@ -199,4 +199,10 @@ struct NOT_DEFINED_STRUCT_THAT_SWALLOWS_SEMICOLON
|
||||
#define OPTIMIZED_FOR for
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define EXTERN_C extern "C"
|
||||
#else
|
||||
#define EXTERN_C
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -846,12 +846,6 @@ void keyboard_control::msg_received() {
|
||||
}
|
||||
}
|
||||
|
||||
#define FORCE_UNDEFINED_SYMBOL(x) void* __ ## x ## _fp =(void*)&x;
|
||||
/**
|
||||
* This needs to be in uv executable to be able to provide it to GL/SDL
|
||||
* display modules (modular build) therefore FORCE_UNDEFINED_SYMBOL is used
|
||||
* @todo Find a systematic solution
|
||||
*/
|
||||
void keycontrol_send_key(struct module *root, int64_t key) {
|
||||
struct msg_universal *m = (struct msg_universal *) new_message(sizeof(struct msg_universal));
|
||||
sprintf(m->text, "press %" PRId64, key);
|
||||
@@ -861,7 +855,6 @@ void keycontrol_send_key(struct module *root, int64_t key) {
|
||||
}
|
||||
free_response(r);
|
||||
}
|
||||
FORCE_UNDEFINED_SYMBOL(keycontrol_send_key)
|
||||
|
||||
/** @brief Registers callback message for given key
|
||||
*
|
||||
@@ -888,5 +881,4 @@ bool keycontrol_register_key(struct module *receiver_mod, int64_t key, const cha
|
||||
free_response(r);
|
||||
return true;
|
||||
}
|
||||
FORCE_UNDEFINED_SYMBOL(keycontrol_register_key)
|
||||
|
||||
|
||||
@@ -106,8 +106,10 @@ private:
|
||||
std::mutex m_lock;
|
||||
};
|
||||
|
||||
extern "C" void keycontrol_send_key(struct module *root, int64_t key);
|
||||
extern "C" bool keycontrol_register_key(struct module *sender_mod, int64_t key, const char *message, const char *description);
|
||||
// attribute used guaranties that the symbol is present even if not referenced (modular build)
|
||||
/// @todo all UG core functions should have the 'used' attribute
|
||||
EXTERN_C void keycontrol_send_key(struct module *root, int64_t key) ATTRIBUTE(used);
|
||||
EXTERN_C bool keycontrol_register_key(struct module *sender_mod, int64_t key, const char *message, const char *description) ATTRIBUTE(used);
|
||||
|
||||
#endif // keyboard_control_h_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user