Closed heuripedes closed 9 years ago
This structure is allocated by the core, and written by the front. If the front thinks it sees the new structure, but the core has only allocated enough space for the old one, the front will scribble over something random, for example a return address. That is indeed an ABI break, and you know our policy on that.
I don't want to introduce a new env for this either, for various reasons:
For libretro v2, I want this logger replaced with a plain const char*. It's kinda irritating to work with ...s outside of C/C++.
You're very welcome to use va_start in the front, though. Or asprintf()/vasprintf() and do whatever with the resulting char*.
retro_log_callback is currently defined as
Due to the lack of
va_call
macro/function in the C language, providing only a variadic function pointer is an inflexible way to support callbacks because it does not allow the developer to make wrappers if he so desires/needs. One use case for this would be preprocessing (e.g. adding extra data to the log message) or displaying the log message on the screen (e.g. in-game debug console).What I propose is
vprintf()
-style callback that could either replaceretro_log_printf_t
or be appended to theretro_log_callback
:The first option does break the ABI but I'm not entirely sure about the effects of second one.