Jump to content

CompileIt - an experimental AutoIt-to-machine code compiler


scintilla4evr
 Share

Recommended Posts

Hi. 

I have Code Blocks installed and nothing much to do with it... :(

Welcome to Code::Blocks 13.12!
Code::Blocks is a full-featured IDE (Integrated Development Environment) aiming to make the individual developer (and the development team) work in a nice programming environment offering everything he/they would ever need from a program of that kind.
Its pluggable architecture allows you, the developer, to add any kind of functionality to the core program, through the use of plugins...

I get this error when compiling the Hello, World!.c ...

#include "#1 - Hello, World!.h"

// Globals

// Script entry
int main() {

au3_consolewrite(string_variant(L"Hello, World from machine code AutoIt!"));


return 0;
}
______________________________
Build log:

mingw32-gcc.exe   -c "C:\AutoIt\CompileIt\test\__build\#1 - Hello, World!.c" -o "C:\AutoIt\CompileIt\test\__build\#1 - Hello, World!.o"
mingw32-g++.exe  -o "C:\AutoIt\CompileIt\test\__build\#1 - Hello, World!.exe" "C:\AutoIt\CompileIt\test\__build\#1 - Hello, World!.o"   
C:\AutoIt\CompileIt\test\__build\#1 - Hello, World!.o:#1 - Hello, World!.c:(.text+0x16): undefined reference to `string_variant'
C:\AutoIt\CompileIt\test\__build\#1 - Hello, World!.o:#1 - Hello, World!.c:(.text+0x22): undefined reference to `au3_consolewrite'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Perhaps the ChakraCore.dll is in the wrong place? 

Skysnake

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

43 minutes ago, Skysnake said:

Perhaps the ChakraCore.dll is in the wrong place? 

Okay, so the ChakraCore.dll has nothing to do with the actual C code compilation process - it's used to execute the parser used to convert AutoIt code to C. You got the resulting C code, so ChakraCore had done its job.

And with the build, the reason why it doesn't work is the fact that the C files from CompileIt's include/ directory had not been compiled with the input source code.

So, I would recommend using the CompileIt.exe for compiling those scripts.

But if you find Code::Blocks more comfortable, just add the files from CompileIt's include/ directory to your project. The build should continue just fine.

Edited by scintilla4evr
Link to comment
Share on other sites

:)

Got this far

-------------- Build: Debug in CompileItExample (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall -g  -c "C:\AutoIt\CompileIt\project\#1 - Hello, World!.c" -o "obj\Debug\#1 - Hello, World!.o"
mingw32-gcc.exe -Wall -g  -c C:\AutoIt\CompileIt\project\AutoItFuncs.c -o obj\Debug\AutoItFuncs.o
C:\AutoIt\CompileIt\project\AutoItFuncs.c: In function 'au3_stringlen':
C:\AutoIt\CompileIt\project\AutoItFuncs.c:32:5: warning: passing argument 1 of 'wcslen' from incompatible pointer type [enabled by default]
     return int_variant(wcslen(vt.data_ptr));
     ^
In file included from C:\AutoIt\CompileIt\project\AutoItFuncs.c:4:0:
c:\program files (x86)\codeblocks\mingw\include\string.h:133:40: note: expected 'const wchar_t *' but argument is of type 'int *'
 _CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*);
                                        ^
C:\AutoIt\CompileIt\project\AutoItFuncs.c: In function 'au3_stringreverse':
C:\AutoIt\CompileIt\project\AutoItFuncs.c:38:5: warning: passing argument 1 of 'wcsrev' from incompatible pointer type [enabled by default]
     return string_variant(wcsrev(vt.data_ptr));
     ^
In file included from C:\AutoIt\CompileIt\project\AutoItFuncs.c:4:0:
c:\program files (x86)\codeblocks\mingw\include\string.h:185:42: note: expected 'wchar_t *' but argument is of type 'int *'
 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsrev (wchar_t*);
                                          ^
C:\AutoIt\CompileIt\project\AutoItFuncs.c: In function 'au3_stringcompare':
C:\AutoIt\CompileIt\project\AutoItFuncs.c:44:5: warning: passing argument 1 of 'wcscmpi' from incompatible pointer type [enabled by default]
     return int_variant(wcscmpi(vt1.data_ptr, vt2.data_ptr));
     ^
In file included from C:\AutoIt\CompileIt\project\AutoItFuncs.c:4:0:
c:\program files (x86)\codeblocks\mingw\include\string.h:173:29: note: expected 'const wchar_t *' but argument is of type 'int *'
 int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2);
                             ^
C:\AutoIt\CompileIt\project\AutoItFuncs.c:44:5: warning: passing argument 2 of 'wcscmpi' from incompatible pointer type [enabled by default]
     return int_variant(wcscmpi(vt1.data_ptr, vt2.data_ptr));
     ^
In file included from C:\AutoIt\CompileIt\project\AutoItFuncs.c:4:0:
c:\program files (x86)\codeblocks\mingw\include\string.h:173:29: note: expected 'const wchar_t *' but argument is of type 'int *'
 int __cdecl __MINGW_NOTHROW wcscmpi (const wchar_t * __ws1, const wchar_t * __ws2);
                             ^
mingw32-gcc.exe -Wall -g  -c C:\AutoIt\CompileIt\project\CompileIt.c -o obj\Debug\CompileIt.o
C:\AutoIt\CompileIt\project\CompileIt.c: In function 'variant_getstring':
C:\AutoIt\CompileIt\project\CompileIt.c:86:9: warning: return makes pointer from integer without a cast [enabled by default]
         return *((wchar_t*)vt.data_ptr);
         ^
mingw32-g++.exe  -o bin\Debug\CompileItExample.exe "obj\Debug\#1 - Hello, World!.o" obj\Debug\AutoItFuncs.o obj\Debug\CompileIt.o   
Output file is bin\Debug\CompileItExample.exe with size 53.05 KB
Process terminated with status 0 (0 minute(s), 0 second(s))
0 error(s), 5 warning(s) (0 minute(s), 0 second(s))

My cbp project file

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="CompileItExample" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/CompileItExample" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/CompileItExample" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
		</Compiler>
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>

which results in

compileIt.png

:):):):):):):):):):):):):):):):):):):):):):):)

You rock man!

Skysnake

 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

21 minutes ago, Deye said:

So this potentially will have faster execution times to what it can support so far

Well, according to some simple tests I performed while developing new features, CompileIt reached about 2x faster execution. But when I got to loops with a lot of iterations, it sometimes executed slower than AutoIt, because the whole thing is not optimized in any way.

But then again, let us wait and maybe things will change :)

Link to comment
Share on other sites

Development suggestion? My problem is this: the compiled EXE is so fast, its almost impossible to see it processing...  Suggested solution: include a standard "filewrite" option to write to disk during execution.  Much like AutoIt's FileWrite or FileWriteLog functions.  Then one can trace the EXE activity.

Perhaps there is a different/better solution?

:)


 

Edited by Skysnake

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

1 hour ago, Skysnake said:

Development suggestion? My problem is this: the compiled EXE is so fast, its almost impossible to see it processing...  Suggested solution: include a standard "filewrite" option to write to disk during execution.  Much like AutoIt's FileWrite or FileWriteLog functions.  Then one can trace the EXE activity.

Perhaps there is a different/better solution?

:)


 

File manipulation/creation functions are on the to-do list, but first I want to make sure that Strings are more functional (for example, adding the & operator).

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...