PLEASE do not pull yet: this is a request for comments.
If the modbus DLL is linked with a GUI application there is no stderr to write to.
It may be solved in the application, but it's not often done.
Use the dbgprintf, that behaves differently under windows or other OSes.
* I removed the ctx->debug tests, I thing the speed gain they need is minimal,
and the new interface allows to dynamically select the verbosity level.
* I also had to replace perrors(), because the Windows socket functions DO NOT set
Is this acceptable ?
Introduce a new debugging function.
I've in mind to use a logger such as https://git.kernel.org/cgit/linux/kernel/git/kay/libabc.git/tree/src/libabc.c#n55
Ehmm, libabc_private.h uses attribute, and that is not compatible with Microsoft C. My solution is already tested, and I have a branch of libmodbus fully converted if acceptable. For bonus points I aslo have lighly organized the packet dump functions. Anyway it's your call. Do you want to see my fully converted branch ?
Yes could you share your branch?