Skip to content

Build Engine

zenonet edited this page May 13, 2022 · 2 revisions

Works in: v0.4+

You can create create native x86 .exe binaries using SusLang -build or SusLang -b from the SusLang CLI.
The syntax in the CLI goes like this: SusLang -build <scriptToCompile> <pathForTheExeFile>
SusLang binaries created like this are completely independent from the SusLang-CLI, the SusLang-Compiler and Dotnet.

How the buildEngine works

On the BuildEngine Side

First, the BuildEngine copies the SusLangBuildLoader binary file from the internet. (It is available here: http://api.zenonet.de/SusLang/SusLangBuildLoader.exe)
Then, the BuildEngine adds the script you want to build to the end of the SusLangBuildLoader-File.
Lastly, it adds the byte index where the script begins to the end of the file. That's it.

On the BuildLoader Side

When the build loader gets executed, it opens a FileStream to itself and reads the last 8 bytes of the file.
These are converted into a long (int64) which determines the start index of the script.
At this point, the BuildLoader just goes to that index and reads the entire script from there.
Lastly it just executes the script using it's internal inperpreter.

As you can see, this doesn't really have anything to do with compilaton. And the builds aren't faster or significantly smaller than the CLI + the script.
The only advantage is that these builds are indipendent from SusLang and Dotnet. But lets be honest: Why would you want that?

Clone this wiki locally