bugst / go-serial

A cross-platform serial library for go-lang.
BSD 3-Clause "New" or "Revised" License
658 stars 200 forks source link

Submit custom syscalls to golang #26

Closed cmaglie closed 3 months ago

cmaglie commented 7 years ago

I'm wondering if we can submit the missing syscalls (that we generate with mksyscall & friend) to upstream golang developers to be added to the syscall package, so they could be removed from this library.

After some research here's what I've found:

@albenik (or anyone esle) do you have any experience/opinion on that?

albenik commented 7 years ago

I did a little research while working on some new features for go-serial and found these issues:

  1. https://github.com/golang/go/issues/12853
  2. https://github.com/golang/go/issues/13104

and I think there is no way now to add a new syscalls to golang core packages. Moreover as I understood, syscall / golang.org/x/sys is a packages only for most common syscalls used in golang core and related packages. For any other cases the code generation is a right way.

And about migration to golang.org/x/sys I think it is not urgent but necessary improvement.

albenik commented 7 years ago

https://github.com/cwchiu/go-winapi I did not look closely at the package yet. Jut drop it here for history.

Pros

  1. No need to write/generate own wrappers to windows api calls at least

Cons

  1. External dependency.
  2. Most of api calls where already implemented in go-serial, so it may be unnecessary work
albenik commented 7 years ago

Have to migrate unix codebase to golang.org/x/sys https://github.com/bugst/go-serial/pull/29

cmaglie commented 3 months ago

Some steps forward are being made with the x/sys/windows package, see #187. I'm closing this one since it makes no more sense to keep it open.