I succeeded in modifying Libmodbus to be compilable for Windows CE (ARM). In fact, I compiled it statically with a program, I will try to create a clean DLL project (if I succeed) and I will share it on github.
hints for the people in a hurry :
* stdint.h => there's already a comment related to wchar.h, just change "C" to "C++"
* Search and Change CreateFileA to CreateFile, on MS documentation, they have the same signature
* In modbus.h, put :
#ifdef __cplusplus
extern "C" {
#endif
extern int errno;
#ifdef __cplusplus
}
#endif
and in modbus.cpp define a global int errno variable !
* To fix winsock link errors, just add this :
#pragma comment(lib, "ws2.lib")
under the winsock2 include statement
* strerror and perror are missing ? no problem ! add these two macros somewhere under modbus.h
#define strerror(n) _T("file error")
#define perror(n) _T("file error")
if there's an issue linking wmain like me, in VS => Link edition -> Advanced -> Entry Point -> mainACRTStartup
Best regards.