The main purpose of 'RuntimeSwitcher' is to easily switch between PB's C Runtime (CRT) and the newer Universal C Runtime (UCRT). In addition you can also build your own UCRT (+STL +CLR) using Visual Studio 2015 or later, allowing you to use more recent libraries directly in your PureBasic projects.
Notes:
The UCRT only works with the C backend, the ASM backend is not supported.
With /MD, you must provide Microsoft's Visual C++ Redistributable for OSs prior to Windows 10.
With /MD, you have to add some linker directives to your code (.exe) that aren't automatically picked up by polink. Press the small button above /MD to copy directives to the clipboard.
With /MT, applications created with 'Executable Format: Console' crash when using the PB Debugger.
PB uses setjmp/longjmp with libpng and libjpeg which have issues with the UCRT. To fix this I included both libraries built with VS 2022, but it needs special handling if you create a .dll that uses png/jpg. Toggle the small button above /MT.
The libraries included with RTS are all built with VS 2022, UCRT 10.0.22621.0, VCTools 14.35.32215; libpng.lib 1.6.39; libjpeg.lib 9e;
I haven't tried CLR (Common Language Runtime aka .Net) yet, maybe someone can do some testing? The STL (C++ Standard Template Library) seems to work fine.
At the moment you can only drag & drop 'Native Tools Command Prompt for VS' lnk's (VS 2015+) onto the RTS window.
If you have UAC enabled you need to run the PB IDE as Administrator, so that 'RuntimeSwitcher' can build and copy the libraries.
I'm not sure if I understand this correctly: with the RuntimeSwitcher I can compile PB programmes with Visual Studio?
And thus possibly use newer modern UI elements?
"Daddy, I'll run faster, then it is not so far..."
dige wrote: ↑Thu Mar 23, 2023 9:18 am
I'm not sure if I understand this correctly: with the RuntimeSwitcher I can compile PB programmes with Visual Studio?
And thus possibly use newer modern UI elements?
With RuntimeSwitcher you can use static libraries created with VS 2015+ in PB. The idea was born here (raylib).
But even without static libraries, switching to UCRT will most likely bring a boost in performance due to better memory management...
Fred wrote: ↑Thu Mar 23, 2023 2:27 pm
It's probably only using the MS linker, not VC++.
No, I'm just replacing the original msvcrt.lib (PB\PureLibraries\Windows\Libraries) with a custom one (e.g. VS 2022 libcmt.lib+libvcruntime.lib+libucrt.lib = _MT_17_msvcrt.lib).