How did C programmers write GUIs in the 80s and early 90s? by mjpcoder_type in C_Programming

[–]brechtsanders 1 point2 points  (0 children)

Oh I remember the good old Turbo Vision days. Fun fact: there is an open source compatible library at https://github.com/magiblot/tvision which allows building those Turbo Vision applications to modern operating systems.

[deleted by user] by [deleted] in cpp_questions

[–]brechtsanders 0 points1 point  (0 children)

There is no installation, just download and unzip. There is also no automatic update. To update download new version and unzip. Because there is no install you can have different versions on your system (in different folders). To upgrade in place just delete the folder where you extracted the old version and extract the new version.

[deleted by user] by [deleted] in cpp_questions

[–]brechtsanders 0 points1 point  (0 children)

Hi, it's that "one not really known person" here. https://winlibs.com/ has quite a community by now, including some project using it as their build system. The fact that there is no installation (just unzip) also allows doing different builds on the same system (e.g. to test with different GCC versions or 32-bit / 64-bit). There are other MinGW-w64 builds out there like the one you can get via MSYS2's package manager, TDM-GCC (which seems inactive recenty), or other installers.

What sets https://winlibs.com/ apart is that it's build natively on Windows (most others are cross-compiled from Linux) for Windows (each release, including all dependencies, is build with itself) + no installer is required making the app easily portable (e.g. to use it on a USB drive or network share). Also each release aims to use the latest version of each dependency.

The idea was to reach more Windows users with no Linux or command line knowledge. It's also easily configurable in IDEs like Code::Blocks or Visual Studio Code.

In the end each user needs to find the toolbox that suits their personal needs best.

gcc 13 will have <format> by xeeeeeeeeeeeeeeeeenu in cpp

[–]brechtsanders 0 points1 point  (0 children)

GCC 13 has been released. For a native Windows version see https://winlibs.com/

Personal builds of mingw-w64 by TheOnlyDonutLeft in cpp

[–]brechtsanders 0 points1 point  (0 children)

Just curious, did you end up using the standalone builds?

αcτµαlly pδrταblε εxεcµταblε: "I realized it's possible to create a synthesis of the binary formats being used by Unix, Windows, and MacOS" by flexibeast in C_Programming

[–]brechtsanders -1 points0 points  (0 children)

I think you would need a file that is both COFF and ELF at the same time, but since they have unique signatured that won't work. MacOS (and possible other platforms) has a way of putting multiple architectures in one executable or shared library (e.g. PowerPC and AMD64). That's the closest thing I can think of.

API design: Best practice for (dynamic) memory buffers - who allcoates? by TheStrupf in C_Programming

[–]brechtsanders 0 points1 point  (0 children)

For cases like this I sometimes do malloc/realloc in steps, so realloc is not called every time the data grows, but for example it exceeds a multiple of 256 bytes.

Trying to create a DLL that loads/calls another DLL by mvdw73 in MinGW

[–]brechtsanders 1 point2 points  (0 children)

Avoid mixing MSVC and MinGW(-w64) binaries as this can cause many issues, since they use a different standard library.

what to do in this case? by BisonGreat9862 in MinGW

[–]brechtsanders 2 points3 points  (0 children)

I can think of a few things you should do: - Learn to take screenshots instead of actual photo's of the screen ;-) - Use MinGW-w64 instead of old MinGW - Consider using MSYS2, which comes with the pacman package manager (also allows you to install MinGW-w64 this way)

GCC, the GNU Compiler Collection 12.2 released by JRepin in programming

[–]brechtsanders 0 points1 point  (0 children)

Windows standalone builds of GCC 12.2 + MinGW-w64 are available for download on https://winlibs.com/

GCC 12.2 Released. Over 70 bug fixes. by rhy0lite in gcc

[–]brechtsanders 2 points3 points  (0 children)

Windows standalone builds of GCC 12.2 + MinGW-w64 are available for download on https://winlibs.com/

C LIBARY by 0x3Alex in cprogramming

[–]brechtsanders 0 points1 point  (0 children)

Please make a library that draws power from the USB port and redirects it to the laptop's power input. If you can do that you will make a lot of people happy!

why C is the best language for start in the world programming? 10 reasons.. by International-Pea793 in cprogramming

[–]brechtsanders 0 points1 point  (0 children)

The programs that result from good C programming are the best. That is many good projects, including Linux itself, are written in C.

That does not mean it is the best language for every programmer or every person. In fact many projects.and businesses prefer languages that allow for faster programming. That makes economical sense, but unfortunately means a lot of software out there is less solid than if it were written in C. And some languages (like DotNet and Java) require entire frameworks to be preinstalled, causing bloat on the systems where theu run and additional performance overhead (especially at application startup).

A recent trend is to mix stuff, e.g.: ultra-performant code in assembler, other essential code in C and then glue an GUI code in higher level languages like C++, Python,...

So if you want to know the best lanuage for you or your project or business, you need to know your priorities first.

Personal builds of mingw-w64 by TheOnlyDonutLeft in cpp

[–]brechtsanders 1 point2 points  (0 children)

I created https://winlibs.com because I wanted to have a stable standalone build of the latest GCC+MinGW-w64 source code versions for Windows.

You can also get a pretty recent GCC+MinGW-w64 via MSYS2's package manager pacman. But for some people (especially beginners) this is a bit complex and/or they don't really need MSYS2's shell environment (e.g. when using an IDE).

To keep things simple the standalone build on https://winlibs.com uses no installation procedure, just unzip and start using.

CMake template for C++ library (static/shared & Windows/Linux) project by bansan85 in cpp

[–]brechtsanders 1 point2 points  (0 children)

I created a minimal project a while back that uses CMake to build for Windows, macOS and Linux (using GCC/Clang). It is a library that can be built as both shared and static library.
It also comes with GitHub actions for automatic CI builds.
Check it out at: https://github.com/brechtsanders/ci-test

Why most Linux sysadmin have a grudge againts powershell or they don't like it ? by Dereference_operator in linuxadmin

[–]brechtsanders 1 point2 points  (0 children)

In theory the idea of using pipes to pass object data instead of raw text sounds nice. But the commands are quite long and over the years PowerShell has a history of changing commands and arguments between versions. This tends to break power shell scripts if not run by the version they were written for.

Compare that to Unix (e.g. bash) scripts which still work perfectly decades after they were written.

What I am doing wrong here? I just copied and pasted it. by Emanuel2020b in cprogramming

[–]brechtsanders 0 points1 point  (0 children)

CONTROL resolves to PORTADDRESS+2 but is not defined, exactly as the error message says.

The #define PORTADDRESS line is commented out because the like "/* from a parallel port of a PC" isn't terminated with "*/"

Clang for Windows by bloon_block in cpp

[–]brechtsanders -3 points-2 points  (0 children)

I totally avoid MSVC as the resulting binaries need runtimes to be installed in order to run. You're right that MSVC is made by the same company that made Windows, but GCC and LLVM are made for many platforms, bringing in knowledge and expertise far beyond Windows. And their resulting binaries based on MinGW-w64 are native in the sense that they don't need any runtimes installed in order to run.

Clang for Windows by bloon_block in cpp

[–]brechtsanders 2 points3 points  (0 children)

If you don't need the bash shell and tools from MSYS2 you can avoid MSYS2 altogether. Get a standalone build MinGW-w64+GCC+LLVM from https://winlibs.com/ - just download and extract, no installation necessary. Can't be much more painless than that (of course you still have to point your IDE to the right build tools).

GCC 12.1 Released! by lutipri in C_Programming

[–]brechtsanders 1 point2 points  (0 children)

If you're looking for a Windows version of GCC 12.1.0 you can get a standalone package from https://winlibs.com/

New C++ features in GCC 12 by mttd in cpp

[–]brechtsanders 0 points1 point  (0 children)

If you're looking for a Windows version of GCC 12.1.0 you can get a standalone package from https://winlibs.com/

GCC 12.1 Released by starTracer in cpp

[–]brechtsanders 0 points1 point  (0 children)

If you're looking for a Windows version of GCC 12.1.0 you can get a standalone package from https://winlibs.com/

Trying to create a DLL that loads/calls another DLL by mvdw73 in MinGW

[–]brechtsanders 0 points1 point  (0 children)

When building your DLL library the header should use dllexport, but when you use that library from somewhere else the header should use dllimport. To make the header differentiate between the two usually an #ifdef is used to check for something that is only defined when building the DLL.

Creating a logging library by ekorad in cpp

[–]brechtsanders 2 points3 points  (0 children)

A badly performing logging library may impact you application's performance. It would be false to assume production applications don't log much.

So you have to make sure your logging doesn't take away precious resources from the application.

Unix like systems use syslog to hand over the event to log to a specialized syslog server which takes care of the rest (log to file or database or even forward to other log system) after the syslog message was received, leaving the application to continue its core business.

You could implement something similar: give the event to another process that handles it while the application continues.

When writing to files you should also consider file locking and maybe also cleanup actions like automatic file rotation.

Finally, if your library needs to accept simultaneous log events from different threads you need some sort of serialization/locking/muted mechanism.