Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Conversation

@ruevs
Copy link

@ruevs ruevs commented Feb 14, 2021

by using ANSI C functions instead of obsolete POSIX ones.

by using ANSI C functions instead of obsolete POSIX ones.
@jtsiomb
Copy link
Contributor

jtsiomb commented Feb 15, 2021

At the very least these changes need to be conditional for windows only. The leading-underscore variants of the POSIX calls are certainly not ANSI C, they are a microsoft thing. But also, I'm not convinced that by just changing write to _write will make this work on windows. I would imagine we'd need to go for a CreateFile, MsgWaitForMultipleObjects approach. Did you try this with a serial device, beyond just coaxing the compiler to accept it?

@ruevs
Copy link
Author

ruevs commented Feb 15, 2021

The only device I have is a SpaceExplorer (USB) so I can not test this. That is why I left it as a separate pull request.

The only goal here was to make it compile and remove the errors, reduce the warnings (when compiling with Microsoft Visual Studio Community 2019 Version 16.8.5).

As for _open etc... you are right "_open and _wopen are Microsoft extensions. For more compatibility information, see Compatibility." so I'll rework it.

@jtsiomb
Copy link
Contributor

jtsiomb commented Feb 15, 2021

Don't worry about it, for now just rename serdev.c to serdev_unix.c, and remove it from the windows build (are you using your own visual studio project files? or are you building with mingw?). Then add a serdev_win32.c with an empty spndev_ser_open function that always returns -1. And also enclose the whole file in an #ifdef WIN32 for now, until I fix the makefile to conditionally add platform-specific files to the build. That should be sufficient for now.

@ruevs
Copy link
Author

ruevs commented Jan 24, 2024

Closing since #4 includes this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants