| ▲ | radarroark 3 hours ago |
| Anyone have experience with distributing win32 programs for Linux and/or MacOS by bundling wine? I take it that statically linking is out of the question, but I am guessing you could make an AppImage binary for linux that includes wine, and for MacOS you could include wine in the app bundle. I haven't tried either though. I'm interested in this so I can use win32 as a cross-platform desktop GUI library. |
|
| ▲ | foresto 3 hours ago | parent | next [-] |
| You might consider Flatpak packaging. Flathub offers the org.winehq.Wine package, which you can use in the base and base-version fields of your own package's manifest. It wouldn't cause your code to be statically linked with Wine. Your package could then be distributed from your own flatpak remote. There was an announcement about a year ago of an effort to make a paid flatpak market, apparently to be called Flathub LLC. I don't know if that effort is still active. https://discourse.flathub.org/t/request-for-proposals-flathu... Winelib might also be worth considering, depending on how you are able to navigate the relevant licenses. https://gitlab.winehq.org/wine/wine/-/wikis/Winelib-User's-G... I think Qt would yield better results than Wine for most things. Since your comment suggests that you're making proprietary software, you would have to take special care with linking or else submit to the Qt Group's commercial license terms. |
| |
| ▲ | TingPing 2 hours ago | parent | next [-] | | Most people can use the LGPL version of Qt. | |
| ▲ | bobajeff 2 hours ago | parent | prev [-] | | Flatpak can be pretty buggy with Wine I've had some programs misbehave cause it to eat up all my ram when using bottles for instance. |
|
|
| ▲ | darthcircuit 35 minutes ago | parent | prev | next [-] |
| Check out GameImage! https://github.com/gameimage/gameimage This started out with bundling wine in appimages, but is expanded a lot. The author created a new appimage alternative that adds some stuff to make games work more reliably. I’ve used this several times to create portable versions of old windows games for my Steam Deck. It’s awesome! |
|
| ▲ | circuit10 3 hours ago | parent | prev | next [-] |
| Winelib sounds like what you’re describing about static linking: https://gitlab.winehq.org/wine/wine/-/wikis/Winelib-User's-G... |
| |
| ▲ | Rayosay 6 minutes ago | parent [-] | | As someone who has tried this, I agree that Winelib is the way to go. Just don't go into it expecting it to "just work" without any code changes. Since NTFS is case-insensitive, it's likely that you'll have to fix your include paths to use the right case. If you used any MSVC compiler extensions, you'll likely need to modify your code to not use them or add `#ifdef __GNUC__` with alternative implementations for GCC. GCC's `-fms-extensions` can emulate some of them, but not all. Winemaker can help you with some of the more wrote aspects of this conversion, but not all of it. It will also produce Makefiles for you, but if you want a single build system that works on all platforms, I'd recommend that you use CMake with a CMake toolchain file targeting Winelib and `winegcc` instead. Visual Studio has pretty good CMake support these days, so it should look pretty much like any other Visual Studio solution when you open it there too. Once you do get it working, you'll notice that on first run of your application Wine will create a `~/.wine` directory and populate it just like it would if you created a new Wine prefix to run a standard Windows application in. Other than that, it will feel pretty seamless. You'll even get a native application launcher for it (which is really just a shell script to run your project's `.exe` under Wine, but it's hidden from the user so it feels native if you don't look too closely.) Compiling against Winelib has the added benefit that you'll only be using win32 features that Wine supports, and can use native platform libraries (if you choose to do so when you're compiling your application, as described in the Winelib User's Guide) mixed with Windows libraries from Wine. It's nicer and works more smoothly than just running a Windows application you compiled with Visual Studio under a bundled version of Wine, in my experience. I'm sure that you'd be able to bundle it as an AppImage, but I haven't actually tried that part myself. Good luck! |
|
|
| ▲ | kccqzy 24 minutes ago | parent | prev | next [-] |
| I don’t have experience but I have heard of winelib which is a library implementing Win32 APIs. I suppose you don’t compile your code as PE executable, but compile to Linux natively while dynamically linking to winelib. |
|
| ▲ | mid-kid 2 hours ago | parent | prev | next [-] |
| I've seen a few russian pirated game releases for linux do this, they just bundle a copy of wine (downloaded from the same places as e.g. lutris gets it from), and a start script that sets the WINEPREFIX variable to a pre-populated prefix, with the game already installed and all the needed registry configurations already present.
I suppose you could bundle all this in an AppImage, the annoying part however is that the WINEPREFIX is supposed to be read-write, so you'd have to set it to some place specific to your app, to avoid messing with the user's main prefix. These prefixes are huge (hundreds of MB upon creation), so I'm not sure I'd consider this a desireable solution. If this is your distribution method, consider having the user install wine before running your app. |
|
| ▲ | Rohansi 3 hours ago | parent | prev | next [-] |
| I'm curious why you'd want this over using a GUI library that is actually cross-platform? The way you've worded things suggests to me that you're building something new. |
| |
| ▲ | radarroark 3 hours ago | parent | next [-] | | I want to go back to making desktop programs the way we used to before they turned into web apps that bundled chrome. I know I should just use Qt but I have some experience already with win32, and all the programs I have fond memories of are written with it (foobar2000, winamp, Everything, etc). | | |
| ▲ | purerandomness 3 minutes ago | parent | next [-] | | You might like https://www.lazarus-ide.org/ | |
| ▲ | swinglock 3 hours ago | parent | prev | next [-] | | Win32 and Wine being a lightweight alternative to HTML and Electrum is a fun idea. | | |
| ▲ | Rohansi 3 hours ago | parent [-] | | Wine is going to require at least as much disk space as Electron. Performance and memory usage should at least be better though. |
| |
| ▲ | wizzwizz4 an hour ago | parent | prev [-] | | Have you considered Tk? Visually, it's quite like Win32, but it's fully cross-platform and (as of Tcl 9.0) has basic screen-reader support – so no mucking around with OLEACC shims or IAccessible2, as you'd need for COMCTL32. And it supports virtually everything Win32 does, with the ability to drop down to platform-specific sorcery (i.e., Win32) if the need arises. |
| |
| ▲ | dfabulich 33 minutes ago | parent | prev | next [-] | | Because, as they always say, Win32 is the only stable ABI on Linux. | |
| ▲ | nxobject 3 hours ago | parent | prev | next [-] | | Perhaps a Windows-only RAD framework? (Admittedly, I can only think of VB6...) | | | |
| ▲ | scotty79 3 hours ago | parent | prev [-] | | Visial Studio is quite good for gui. | | |
| ▲ | Rohansi 3 hours ago | parent [-] | | It is. But if you mean .NET WinForms then you don't really need Wine because Wine uses Mono to run .NET executables. If using WPF then you should check out Avalonia UI [1] which is a cross-platform alternative that is also probably better (and has good tooling in VS). There's also .NET MAUI [2] but it's maybe not as good for desktop apps. [1] https://avaloniaui.net/
[2] https://dotnet.microsoft.com/en-us/apps/maui |
|
|
|
| ▲ | cmxch 3 hours ago | parent | prev | next [-] |
| Depending on the use case, you might be able to get away with PowerShell with Pinvoke bindings if your code is more script-like than compiled code. Instead of making your own GUI library, you could just make a shim that translates to whatever framework you want to support. See:
https://learn.microsoft.com/en-us/dotnet/standard/native-int... |
|
| ▲ | transcriptase 2 hours ago | parent | prev [-] |
| That sounds antithetical to the “never just works” philosophy of Linux software. |