Page 1 of 1

Compiling AHK_L with gcc

Posted: 25 Jan 2019, 11:24
by vvhitevvizard
Im not sure is this deserves a separate topic, so I post it here.
About compiling AHK with GCC, the only info I found is 11 years old post:
https://autohotkey.com/board/topic/28748-compiling-with-gcc/
So many things changed since then. Links r dead. I see absolutely different errors flying by. :) I managed to reduce compiler's (GCC 5.1.0-2 x64) errors down to 15 (I disabled zillion of warnings) but stuck atm. I'm well aware its only the first step of getting AHK compiled. To make .exe completely functional might require much longer time. Nonetheless the path might be not so hard - Id like to assess it at least.
errors
Is here anybody who tried to compile AHK L v2 with GCC recently?

Moderators Note: Split to a seperate topic nnnik

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 02:17
by SOTE
I hope the more knowledgeable members that know C++ and use GCC can help you. Putting AHK on GCC would be huge and it seems that it would increase the likelihood of a cross-platform AutoHotkey.

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 03:28
by nnnik
Best of luck

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 05:04
by vvhitevvizard
SOTE wrote:
26 Jan 2019, 02:17
Putting AHK on GCC would be huge and it seems that it would increase the likelihood of a cross-platform AutoHotkey.
Even before cross-platforming stuff, GCC compiled AHK v2 would definitely increase performance.

Also GCC gives some additional hints on actual errors by C++ standards (which r permitted by Microsoft compiler) that might lead to possible bugs at run time, e.g.:

Code: Select all

r:\ahk\source\script.h:2022:69: error: invalid conversion from 'const wchar_t*' to 'LPTSTR {aka wchar_t*}' [-fpermissive]

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 05:11
by nnnik
The more up to date GCC compiler should perform better than Visual Studio 2015.
Newer Visual Studio versions are probably going to be equal to it.
Sadly I don't see anyone compiling AHK with GCC.
If the Microsoft compiler permits minor errors in the C++ standards its because they won't lead to runtime errors.

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 05:27
by vvhitevvizard
nnnik wrote:
26 Jan 2019, 05:11
If the Microsoft compiler permits minor errors in the C++ standards its because they won't lead to runtime errors.
Not explicit errors but the possibility of unexpected results. As I got it Microsoft is not so strict when it comes to casting variables to a different type. In the indicated error above a string that was expected to be constant becomes mutable. It might or might not lead to possible errors. Anyways removing the ambiguity in the source would not hurt :)

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 05:35
by nnnik
There are a few times when the alternative code is slower.

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 06:05
by vvhitevvizard
I used to think Microsoft was behind 1 step but whether latest version GCC compiled AHK is faster or not is subject to testing ofc ;)

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 06:29
by nnnik
Oh I believe the gcc version will be faster since we use an old visual studio version.

Re: Compiling AHK_L with gcc

Posted: 26 Jan 2019, 06:36
by vvhitevvizard
About C++ compiler's support for new features - detailed table: https://en.cppreference.com/w/cpp/compiler_support
nnnik wrote:
26 Jan 2019, 06:29
Oh I believe the gcc version will be faster since we use an old visual studio version.
In read.me file Lexikos wrote that AHK v2 was compiled using Microsoft Visual Studio Community 2015 Express - not so old tho Microsoft boasts they added some revolutionary changes in VS 2017 but it would be really interesting to see how latest GCC manages with. :)

Re: Compiling AHK_L with gcc

Posted: 27 Jan 2019, 23:18
by SOTE
I don't know if you already saw these, but here is the location of tinku99's old files for compiling AHK on gcc.

https://github.com/tinku99/ahkx