libsml icon indicating copy to clipboard operation
libsml copied to clipboard

WIP: add sml_error function pointer, allow user to intercept error messages

Open r00t- opened this issue 3 years ago • 1 comments

a basic attempt at fixing #17 .

replaces hardcoded fprintf() calls with an sml_error function pointer that can be overwritten by code using the library. a default is provided that mimics the old behaviour (write to stderr with a "libsml:" prefix and appended newline.

includes a test, test also demonstrates usage.

note that this breaks backwards compatibility (code assuming sml_error exists won't build or run with older versions of the library), so we should probably bump the version when merging this.

also we should consider if we maybe want a more sophisticated interface.

r00t- avatar Dec 28 '20 02:12 r00t-

@jahir: you beat me to mentioning this in #109 . it's sad that this is stalled for 1.5 years, but it got very little feedback after i submitted it. maybe you can add some? i'm mostly wondering if the API is sensible, see https://github.com/volkszaehler/libsml/pull/93#discussion_r549201545 .

r00t- avatar Feb 09 '23 17:02 r00t-