Closed xatom closed 12 years ago
Perhaps this patch should be ignored. I was looking through closed bug reports, and it was mentioned that libmodbus has not been designed to work with Cygwin. Having built the library, but running into several bugs when trying to use it, it's become apparent that making this library work with Cygwin is not a light undertaking, and one that I am personally unable to tackle at this time.
Having said that, trying to run a full GNU system on top of Windows is a bit like putting an Formula 1 suspension in a Plymouth Reliant — sure, now it handles like it's on rails, but that doesn't change the fact that the car itself is an unreliable dog.
I'll attempt building with MinGW, see if I can solve my dilemma in that direction. I have no access to a real operating system, so I'll have to make due.
I've successfully built libmodbus master on Cygwin with a few minor modifications. The stumbling block was the configuration flags
HAVE_DECL_TIOCSRS485
: since there's no Linux kernel present, this flag is guaranteed to be 0 on Cygwin, but it cut out otherwise valid code for bothioctl
and part of themodbus_rtu_t
structure.I've included a patch with the changes I made. As a side-note, I modified
.gitignore
to so *.exe files are ignored as well; this allows building of the test suite without git asking questions.Included is a patch detailing the changes from master I've made to fix the problem. This may not be the correct way to go about these changes—C is not my language of choice, so I may be unaware of particular conventions or subtle language pitfalls.