Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to compile programs that use ATL using GCC (MinGW or otherwise) given it uses __try?

I'm confused how people use MinGW to compile Windows programs.

I tried using it, but headers like atlalloc.h and atlcom.h use __try in a few ways... which no version of GCC appears to support, for example:

__declspec(noinline) inline bool _AtlVerifyStackAvailable(_In_ SIZE_T Size) {
    bool bStackAvailable = true;
    __try {
        ...

How do people compile Windows programs with GCC-based toolchains? Do they simply avoid ATL altogether? Or is there some way to make ATL work with these?

like image 884
user541686 Avatar asked Feb 01 '26 07:02

user541686


1 Answers

  1. There's re-implementation of Active Template Library taken from ReactOS and licensed under LGPL 2.1+: https://github.com/katahiromz/RATL.

Since usually people use MinGW to not buy MSVC license (Community edition for example doesn't allow to be used in commercial software development if you're a contractor for enterprise), the licensing terms are important, more details can be found in this quite elaborate answer: https://opensource.stackexchange.com/a/14127.

  1. __try statement is part of SEH, which is not fully supported for MinGW/LLVM; but those parts were re-written in aforementioned library.

  2. There's also partial implementation of ATL in WINE (see https://github.com/wine-mirror/wine/blob/master/include/atl*.h files), but AFAIK, there's no ready-to-be-used library yet.

like image 194
Andrey Starodubtsev Avatar answered Feb 03 '26 22:02

Andrey Starodubtsev