Compiling AHK_L with gcc

Discuss the future of the AutoHotkey language
User avatar
vvhitevvizard
Posts: 299
Joined: 25 Nov 2018, 10:15
Location: Russia

Compiling AHK_L with gcc

25 Jan 2019, 11:24

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
SOTE
Posts: 893
Joined: 15 Jun 2015, 06:21

Re: Compiling AHK_L with gcc

26 Jan 2019, 02:17

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.
Last edited by SOTE on 26 Jan 2019, 03:53, edited 1 time in total.
User avatar
nnnik
Posts: 4365
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Compiling AHK_L with gcc

26 Jan 2019, 03:28

Best of luck
Recommends AHK Studio
User avatar
vvhitevvizard
Posts: 299
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: Compiling AHK_L with gcc

26 Jan 2019, 05:04

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]
User avatar
nnnik
Posts: 4365
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Compiling AHK_L with gcc

26 Jan 2019, 05:11

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.
Recommends AHK Studio
User avatar
vvhitevvizard
Posts: 299
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: Compiling AHK_L with gcc

26 Jan 2019, 05:27

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 :)
User avatar
nnnik
Posts: 4365
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Compiling AHK_L with gcc

26 Jan 2019, 05:35

There are a few times when the alternative code is slower.
Recommends AHK Studio
User avatar
vvhitevvizard
Posts: 299
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: Compiling AHK_L with gcc

26 Jan 2019, 06:05

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 ;)
User avatar
nnnik
Posts: 4365
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Compiling AHK_L with gcc

26 Jan 2019, 06:29

Oh I believe the gcc version will be faster since we use an old visual studio version.
Recommends AHK Studio
User avatar
vvhitevvizard
Posts: 299
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: Compiling AHK_L with gcc

26 Jan 2019, 06:36

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. :)
SOTE
Posts: 893
Joined: 15 Jun 2015, 06:21

Re: Compiling AHK_L with gcc

27 Jan 2019, 23:18

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

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 25 guests