3 ms·
I'm not sure which parts of that you are referring to as unavoidable since C can do modules just fine without any mess. Define the functions you want to impleme
by birc_a 10y ago
I'm not sure which parts of that you are referring to as unavoidable since C can do modules just fine without any mess.
Define the functions you want to implement as static functions and add something like this at the bottom of the file:
outputmodule_t omstdout = { .name = "omstdout", .description = "blah", .init = prepare_stdout, .do_action = write_to_stdout }
#if COMPILING_FOR_RUNTIME_LOADING
outputmodule_t *rsyslog_outputmodule = &omstdout;
#endif
Then either stick `omstdout` in a list of modules known at compile-time or compile separately and use dlopen/dlsym to get the one necessary symbol.
No GNUisms, no language extensions, no linker tricks, no macro magic.
C has problems but it's not that hard to create readable code in it.