Skip to content

plugin: add Windows support #19282

Open

Description

@QuestionPython

hi
Plugin Pkg Work for Windows!?
i want use this for mac,linux,win,... os.
when(what time) fix this?

https://golang.org/pkg/plugin/

Activity

  1. changed the title [-]Plugin Pkg for Windows![/-] [+]plugin: add Windows support[/+] on Feb 24, 2017
  2. added this to the Unplanned milestone on Feb 24, 2017
  3. bradfitz commented on Feb 24, 2017

    @bradfitz
    Contributor

    There is currently nobody working on it, as far as I know.

    /cc @alexbrainman @crawshaw

  4. QuestionPython commented on Feb 24, 2017

    @QuestionPython
    Author

    mean in go 1.8 , plugin pkg work for apple-mac,windows and more ?

  5. bradfitz commented on Feb 24, 2017

    @bradfitz
    Contributor

    @QuestionPython, yes, it's even documented in multiple places:

    https://golang.org/pkg/plugin/

    Currently plugins only work on Linux.

    https://golang.org/doc/go1.8#plugin

    Plugin support is currently only available on Linux.

  6. alexbrainman commented on Feb 24, 2017

    @alexbrainman
    Member

    There is currently nobody working on it, as far as I know.

    I am not working on it. Sorry.

    Alex

  7. bradfitz commented on Feb 26, 2017

    @bradfitz
    Contributor

    We delete all "me too" voting comments per https://golang.org/wiki/NoMeToo. Vote with emoji reactions at top instead.

  8. locked and limited conversation to collaborators on Mar 3, 2017
  9. bradfitz commented on Mar 3, 2017

    @bradfitz
    Contributor

    The "me too" comments wouldn't stop, so this issue is now locked. If there are updates, they will be made here.

  10. unlocked this conversation on Feb 5, 2018
  11. deleted a comment from zhaoya881010 on Feb 5, 2018
  12. 0xdevalias commented on Apr 20, 2018

    @0xdevalias

    Out of curiosity, do we know how much effort it would take to implement windows support? Or if there are any blockers to it (and what they are?)

  13. akavel commented on Apr 23, 2018

    @akavel
    Contributor

    Notably, the recently published Go kernel for Jupyter notebooks is using buildmode=shared, and thus doesn't currently support Windows natively. This is a very cool use case, adding a REPL-like live coding feature to the Go ecosystem, thus it would be really awesome if someone tried to start work on buildmode=shared on Windows to support this use case.

    Similar to @0xdevalias , I'm quite interested in some hints as to what is missing for this to work on Windows? I'm especially curious what extra work is needed given that c-shared is already implemented on Windows?

  14. alexbrainman commented on Apr 23, 2018

    @alexbrainman
    Member

    @0xdevalias and @akavel I don't have any effort estimation or any hints as to what missing here. I have not actually looked at what is involved. I am so much behind at fixing old issues ...

    Alex

  15. 82 remaining items

  16. lvyonghuan commented on Nov 8, 2024

    @lvyonghuan

    This issue is open for 7 years now and plugin support is still not implemented for windows... will it ever happen?

    I'm pessimistic. I feel like people have forgotten that the plugin package exists - it's too rudimentary and has limited support. But I feel that if the plugin package can be done well, what it can achieve is still very powerful.

    To some extent, go lacks a multi-terminal hot reloading mechanism. The plugin package makes up for this. The problem is that it is only applicable to Linux and has many shortcomings.

    Maybe the plugin feature is just an experimental product.

    When I was thinking about a new project today, I wanted to implement some kind of hot reloading and other features. I found that go is really suitable, but the biggest flaw is that the plugin package is terrible.


    It's quite sigh-worthy. Last year, I published my needs under this problem. This year, the bottom is still my needs and other people's solutions. It just stopped there.


    By the way, isn't it because win is owned by Microsoft?


    I just saw an article saying that the Go team said they would not get involved in hot reloading to take advantage of the speed of static linking in Go, "and the community agreed".

    In this case, I'd better use c#. Despite the loss of lightweight threads.

  17. iRedTea commented on Dec 22, 2024

    @iRedTea
  18. nathany commented on Nov 3, 2025

    @nathany
    Contributor

    I noticed that x/sys/windows has some LoadLibrary functionality to load DLLs.
    https://pkg.go.dev/golang.org/x/sys/windows#LoadLibrary

    The API isn't the same as plugin, but I wonder if it could be used with a -plugin DLL written in Go on Windows?

    @qmuntal I saw your GopherCon Europe Lightning Talk on YouTube, and I was wondering if you are familiar with this?

    FYI, my use case is for hot code reloading without restarting an application. Incremental linking (hot binary patching) is an alternative solution, but that is likely more complicated than DLLs.

    Despite some caveats/limitations with the approach, the plugin library has been used successfully for tweaking game and UI code while running on Linux (but not yet on Windows).

  19. nf-brentsaner commented on Dec 19, 2025

    @nf-brentsaner

    By the way, isn't it because win is owned by Microsoft?

    No, it's because Windows notoriously has more friction in its design and is terribly designed at the system level.

    For example, compare something you'd think would be simple: changing ownership for a file or directory.

    In *NIX-likes, it's:

    1. Look up the UID of the user/GID of group
    2. A single kernel syscall (chown()) with that UID and GID and the file's path
      2.1. (Or fchown() if you want to use an FD instead, or lchown if you want to change ownership of a symlink itself, or fchownat if you want to save on some additional supporting/prep routine.)

    For Windows, you need:

    1. To look up the (significantly more obtuse) SID.
      1.1. But be careful! One user can have multiple SIDs depending on context.
    2. But also make sure that SID is valid for the context. Can't set the built-in Administrator SID universal constant as the owner of the file.
    3. And then you can call - oh shoot, but Windows has multiple SIDs associated with a file, each of which may either be a user or a group. Ok, you better not break those, so you have to get the current list.
      3.1. So instead of just doing an os.Stat on the file and casting to a *syscall.Stat_t to get the current ownership info like in *NIX, you have to first get the current NamedSecurityInfo of the file (which is a whole-ass struct).
      3.2. Remember to define your handler and pointers for the owning user and group SID first!
    4. And THEN you can change it with the new user/group SIDs.

    And that's just changing the ownership of a file/directory.

    So no, it's not because "win is owned by Microsoft". It's because Windows is convoluted, messy, and obtuse so something like a runtime-loaded internal plugin system is significantly more of a pain on Windows.

  20. naikrovek commented on Dec 20, 2025

    @naikrovek

    Windows is convoluted, messy, and obtuse

    Not quite as obtuse as your comment.

    Windows makes a lot more sense when you look at it through the lens of Windows, instead of the lens of Unix or Linux. The Windows kernel has quite a few excellent features that no Unix or Linux has. Of course, Linux fans will dismiss them all because they are myopic so I won't get into them here.

    Dynamically loaded libraries are very easy to do in Windows. A DLL, like any Linux shared library, is just a set of functions without a default entrypoint like main() compiled into a file. A file which can be compiled separately from any executables that need it, and be loaded and unloaded on demand.

    If it's hard for Go to do this on Windows, it's because of how the Go runtime works, not because of Windows being obtuse. It is extremely simple to load a DLL on windows. There are syscalls to do it on Windows, just like on Linux. If those don't work in Go on Windows it's because of Go making assumptions or choices which favored Linux, did not favor Windows, and now make Windows implementation of plugins difficult. Sort of a "paint yourself into a corner" kind of move.

    Besides, I don't think the demand for Go plugins on Windows is very high. And I don't think supporting every last feature on Windows was high on the priority list for the Go team early on when these systems were first implemented.

    Windows does do things differently, yes. But virtually every application on Windows loads DLLs; if Go can't do that for some reason, it's something specific to Go that is the problem, not Windows.

  21. ianlancetaylor commented on Dec 20, 2025

    @ianlancetaylor
    Contributor

    Plugins have not been a priority on any platform. They barely work anywhere.

    Loading a DLL on WIndows is just as easy as loading a shared library on an ELF system. What is harder on Windows is creating a DLL, because you need an explicit export list (in C this explicit list is expressed using dllexport annotations and the like). Also Windows doesn't have ad hoc symbol interposition, which makes it reasonably simple (on ELF systems) for the plugin and the executable to agree on a single runtime. The effect is that setting up plugins on ELF systems was a quick hack, and on Windows it would be a less trivial hack. There are good reasons why Windows is different, it just happens that those reasons make it harder for a system like Go to add trivial plugin support. Go could add more complex plugin support, but that would require solving all the problems that plugins have on ELF systems, and nobody has worked on that.

  22. naikrovek commented on Dec 21, 2025

    @naikrovek
  23. zandercodes commented on May 30, 2026

    @zandercodes

    Hey everyone, I've managed to get part of the plugin architecture running on Windows. Unfortunately, there are still a few features that aren't working, such as allocations, fmt, sync.Pool, and goroutines.
    For "fmt," only "Print" and "Log" are working.
    That took me about three days of work.
    I’ll release the Go project once everything is working properly. I still need to test a lot of Go functions.

    EDIT:
    No need to include screenshots; the code is already public.

  24. phaus commented on May 30, 2026

    @phaus

    Thx for the update 👍
    Do you have a fork with the changes? I never really get, why people want to share code via screenshots :-)

  25. zandercodes commented on May 30, 2026

    @zandercodes

    Thx for the update 👍 Do you have a fork with the changes? I never really get, why people want to share code via screenshots :-)

    This is just a quick preview to prove that it's real. I'll publish the updated code as soon as it's final. I don't want to release anything that's half-finished.

  26. zandercodes commented on Jun 1, 2026

    @zandercodes

    Great news: The first version is ready. If you encounter any issues, please let me know in my Go project.
    Currently, only AMD64 is supported.

    https://github.com/zandercodes/go/releases/tag/feature_windows_plugin_support_go1.26.3

    EDIT:
    The Final version is pushed.
    The only thing missing now is support for ARM64.

  27. Linkangyis commented on Jun 1, 2026

    @Linkangyis

    好消息:第一个版本已经准备好了。如果你遇到任何问题,请在我的 Go 项目中告诉我。目前,仅支持AMD64。

    https://github.com/zandercodes/go/releases/tag/feature_windows_plugin_support_go1.26.3

    After all these years, is this issue finally getting put to rest? But it looks like we still need to run a ton of unit tests before merging to main.

  28. zandercodes commented on Aug 24, 2026

    @zandercodes

    The pull request is now a draft. I still need to add plugin support for Windows on ARM.
    #81048

  29. gopherbot commented on Aug 24, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/820020 mentions this issue: cmd/link: support Windows plugins

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.OS-Windowscompiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址