mr4th-dynamic-linking/linux_linking/linux_plugin.c

18 lines
422 B
C
Raw Permalink Normal View History

2024-04-23 19:50:20 +00:00
// declare base_func; no mark -> load-time imported symbol
void base_func(void);
// declare base_func; mark it as an exported symbol
__attribute__ ((visibility ("default"))) void plugin_func(void);
// define plugin_func
#include <stdio.h>
__attribute__ ((visibility ("default"))) void
plugin_func(void){
printf("provided by plugin: {\n");
printf(" ");
base_func();
printf(" ");
base_func();
printf("}\n");
}