I am writing a cross-platform shared library ( .so on linux and .dll on Windows) using C. Currently, when there is an error, the library functions return the correct error code and write the error information to stderr library functions also pass information and debugging messages on stdout . This works well for console clients.
Now this library will have client programs that use GUIs programmed using C ++ and wxWidgets. I am wondering what would be the best error handling methods and notification of this? Can a UI application access data on stdout and stderr on all platforms?
An alternative way that I was thinking about is to initialize a library that initializes a structure that will contain pointers to functions. All library functions will have an instance of this structure and call function pointers. Thus, the client can choose where to print messages.
I am wondering what would be the obvious way to solve this? Any help would be great.
c ++ c error-handling shared-libraries
Navaneeth KN
source share