Make the code W$ compatible. Apparently do-able. #9

Open
opened 2024-07-11 09:12:46 +02:00 by bruno · 0 comments
Owner

From #c on Libera :

Jul 11, 2024 07:42:09 <bodiccea> I have only some Linux machines here, and would like to make my code Windows compatible (let say for gcc). Is mingw (+ testing with wine) enough, so that code will compile/run also from Windows/gcc itself ?
Jul 11, 2024 07:45:26 <nitrix> You have to specifically target windows, but then if it cross-compiles on the Linux's MinGW then it should equally compile on a Window's MinGW setup.
Jul 11, 2024 07:46:18 <nitrix> If the libraries are compiled statically then it may also just run without needing your .dll dependencies at all.
Jul 11, 2024 07:48:39 <bodiccea> Oh, perfect, thanks nitrix. And wine for testing would work too, then ?
Jul 11, 2024 07:49:55 <nitrix> I suppose so if the application isn't doing anything too esoteric/Windows-specific that Wine wouldn't support.
Jul 11, 2024 07:50:55 <nitrix> If it's not graphical and you have automated tests, I'd say set up some CI/CD like GitHub Actions, build and run the tests on each OS respectively.
Jul 11, 2024 07:51:59 <bodiccea> I does not do anything, but terminal text output. Maybe "esoteric" would be linux specific code, mmap(), etc... But this is exactly where I want to separate code.
Jul 11, 2024 07:52:01 <pragma-> You can freely download the Windows ISO from microsoft.com and install it in a VM. Just say "I don't have a CD key" when it prompts for one and it'll let you freely install a slightly restricted Windows (can't change background or colors and other useless things). You can install mingw on it and test things.
Jul 11, 2024 07:53:10 <bodiccea> I did not know about this "free Windows" ISO :-) I will have a look too.
Jul 11, 2024 07:53:44 <vdamewood> I can't speak for MS's legal departent, but from what I understand, if you use it for testing like this, they mostly don't care.
Jul 11, 2024 07:54:41 <pragma-> They don't care at all. They literally give you the option to install it without a CD key. They just restrict a few things like being able to move the taskbar, change background or join a domain
Jul 11, 2024 07:55:03 <pragma-> Probably soem other things too.
Jul 11, 2024 07:55:32 <pragma-> >Microsoft allows users to download, install and use the operating system indefinitely without having to enter a valid product key or digital license.
Jul 11, 2024 07:56:13 <pragma-> Oh, you CAN join a domain.
Jul 11, 2024 07:56:32 <pragma-> I would have expected them to disable that to force corporate to buy licenses.
Jul 11, 2024 07:56:37 <vdamewood> I think it's just the bqckground image going black, and he nag text.
Jul 11, 2024 07:56:39 <zelest> Real friends don't let friends run Windows :P
Jul 11, 2024 07:56:52 <vdamewood> We're not real friends.
[...]
Jul 11, 2024 08:00:29 <vdamewood> bodiccea: Also, Windows now comes with ssh, so if you're console on ly, you can test and build in ssh without having to touch Windows's GUI.
Jul 11, 2024 08:01:05 <vdamewood> though, cmd over ssh is just as bad as cmd in conhost.
[...]
Jul 11, 2024 08:01:37 <nitrix> bodiccea, Yeah exactly. mmap() isn't in MinGW, there are shims (https://github.com/alitrack/mman-win32) but I'd avoid those.
Jul 11, 2024 08:01:38 <candide> Title of nitrix's link: GitHub - alitrack/mman-win32: mman library for Windows. mirror of https://code.google.com/p/mman-win32/
Jul 11, 2024 08:01:49 * pragma- gestures at cygwin
Jul 11, 2024 08:02:08 * vdamewood gestures at Windows API
Jul 11, 2024 08:02:13 <pragma-> just slap cygwin1.dll in your project and bam
Jul 11, 2024 08:04:54 <nitrix> Not a fan of dynamic libraries but Cygwin is an alternative I guess.
Jul 11, 2024 08:05:13 <bodiccea> nitrix, for the specific mmap() case, it is only for huge pages, so that I will simply use normal aligned allocation for windows (AFAIU).
Jul 11, 2024 08:22:15 <bodiccea> vdamewood, brian__ : *ssh on headless Windows in a VM* ??? It took me 5mn to digest this; I am really impressed, lol
Jul 11, 2024 08:23:45 <brian__> bodiccea, i was just referring to how windows server now has a "core" install option that doesn't install a gui
Jul 11, 2024 08:24:58 <bodiccea> I suppose that one cannot be installed "without key" as we discussed above...
Jul 11, 2024 08:25:51 <brian__> there are ways of course
Jul 11, 2024 08:26:01 <bodiccea> I mean legal.
Jul 11, 2024 08:26:06 <brian__> nope
Jul 11, 2024 08:26:19 <brian__> must have key
Jul 11, 2024 08:28:37 <bodiccea> Nevermind, ssh will be largely enough.```
From `#c` on Libera : ``` text Jul 11, 2024 07:42:09 <bodiccea> I have only some Linux machines here, and would like to make my code Windows compatible (let say for gcc). Is mingw (+ testing with wine) enough, so that code will compile/run also from Windows/gcc itself ? Jul 11, 2024 07:45:26 <nitrix> You have to specifically target windows, but then if it cross-compiles on the Linux's MinGW then it should equally compile on a Window's MinGW setup. Jul 11, 2024 07:46:18 <nitrix> If the libraries are compiled statically then it may also just run without needing your .dll dependencies at all. Jul 11, 2024 07:48:39 <bodiccea> Oh, perfect, thanks nitrix. And wine for testing would work too, then ? Jul 11, 2024 07:49:55 <nitrix> I suppose so if the application isn't doing anything too esoteric/Windows-specific that Wine wouldn't support. Jul 11, 2024 07:50:55 <nitrix> If it's not graphical and you have automated tests, I'd say set up some CI/CD like GitHub Actions, build and run the tests on each OS respectively. Jul 11, 2024 07:51:59 <bodiccea> I does not do anything, but terminal text output. Maybe "esoteric" would be linux specific code, mmap(), etc... But this is exactly where I want to separate code. Jul 11, 2024 07:52:01 <pragma-> You can freely download the Windows ISO from microsoft.com and install it in a VM. Just say "I don't have a CD key" when it prompts for one and it'll let you freely install a slightly restricted Windows (can't change background or colors and other useless things). You can install mingw on it and test things. Jul 11, 2024 07:53:10 <bodiccea> I did not know about this "free Windows" ISO :-) I will have a look too. Jul 11, 2024 07:53:44 <vdamewood> I can't speak for MS's legal departent, but from what I understand, if you use it for testing like this, they mostly don't care. Jul 11, 2024 07:54:41 <pragma-> They don't care at all. They literally give you the option to install it without a CD key. They just restrict a few things like being able to move the taskbar, change background or join a domain Jul 11, 2024 07:55:03 <pragma-> Probably soem other things too. Jul 11, 2024 07:55:32 <pragma-> >Microsoft allows users to download, install and use the operating system indefinitely without having to enter a valid product key or digital license. Jul 11, 2024 07:56:13 <pragma-> Oh, you CAN join a domain. Jul 11, 2024 07:56:32 <pragma-> I would have expected them to disable that to force corporate to buy licenses. Jul 11, 2024 07:56:37 <vdamewood> I think it's just the bqckground image going black, and he nag text. Jul 11, 2024 07:56:39 <zelest> Real friends don't let friends run Windows :P Jul 11, 2024 07:56:52 <vdamewood> We're not real friends. [...] Jul 11, 2024 08:00:29 <vdamewood> bodiccea: Also, Windows now comes with ssh, so if you're console on ly, you can test and build in ssh without having to touch Windows's GUI. Jul 11, 2024 08:01:05 <vdamewood> though, cmd over ssh is just as bad as cmd in conhost. [...] Jul 11, 2024 08:01:37 <nitrix> bodiccea, Yeah exactly. mmap() isn't in MinGW, there are shims (https://github.com/alitrack/mman-win32) but I'd avoid those. Jul 11, 2024 08:01:38 <candide> Title of nitrix's link: GitHub - alitrack/mman-win32: mman library for Windows. mirror of https://code.google.com/p/mman-win32/ Jul 11, 2024 08:01:49 * pragma- gestures at cygwin Jul 11, 2024 08:02:08 * vdamewood gestures at Windows API Jul 11, 2024 08:02:13 <pragma-> just slap cygwin1.dll in your project and bam Jul 11, 2024 08:04:54 <nitrix> Not a fan of dynamic libraries but Cygwin is an alternative I guess. Jul 11, 2024 08:05:13 <bodiccea> nitrix, for the specific mmap() case, it is only for huge pages, so that I will simply use normal aligned allocation for windows (AFAIU). Jul 11, 2024 08:22:15 <bodiccea> vdamewood, brian__ : *ssh on headless Windows in a VM* ??? It took me 5mn to digest this; I am really impressed, lol Jul 11, 2024 08:23:45 <brian__> bodiccea, i was just referring to how windows server now has a "core" install option that doesn't install a gui Jul 11, 2024 08:24:58 <bodiccea> I suppose that one cannot be installed "without key" as we discussed above... Jul 11, 2024 08:25:51 <brian__> there are ways of course Jul 11, 2024 08:26:01 <bodiccea> I mean legal. Jul 11, 2024 08:26:06 <brian__> nope Jul 11, 2024 08:26:19 <brian__> must have key Jul 11, 2024 08:28:37 <bodiccea> Nevermind, ssh will be largely enough.```
bruno added the
enhancement
label 2024-07-11 09:12:46 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bruno/brlib#9
No description provided.