How to play with Argentum in VSCode (based on Demo v0.0.11)

1. Download and Install

Download and extract argentum-demo.7z archive from Assets at https://github.com/karol11/argentum/releases/
Check it with your preferred anti-malware.

Install and launch VSCode https://code.visualstudio.com/download

Launch VSCode and install extension CodeLLDB

2. Open project

Open the folder with the extracted demo:

Since we will run executables (agc, llvm-link) we need to "trust" its content. (Yes trust me, I am an engineer).

3. Configure debugger

The only parameter that should be set is the path to the liblldb.dll that's located inside the argentum_demo/bin directory. It should be fixed in the argentum-demo/.vscode/settings.json config:

{
    "lldb.displayFormat":       "auto",
    "lldb.showDisassembly":     "auto",
    "lldb.dereferencePointers": true,
    "lldb.consoleMode":         "commands",
    "lldb.library":             "<DIR>/argentum-demo/bin/liblldb.dll"
}

Replace "<DIR>" with your path to the directory where the argentum-demo is located.

4. Syntax highlight

Open the hello_world.ag in the src directory.

In the lower right corner of the status bar click on plain text to switch color highlighting mode.

Select "Configure file association for *.ag

Select Rust of Swift from the list, because they have the closest syntax.

5. Compile and Run

Press Ctrl+Shift+B to compile and run the `hello_world application.
It should write "Hi there" in console:

Do the same with demo.ag: open and Ctrl+Shift+B. It should compile and run:

6. Debugger

Open graph.ag, select any line of code and press F9 to set a breakpoint.

Press F5 to compile the application in debug mode and run it in debugger.

When program stops on a break point, try step through the code (F10/F11) and inspect variables. The separate tutorial on debugging is here: argentum-debugger-v1.

That's it for now.

8 Comments

  1. When I try to compile fizzbuzz.ag, I get the error:
    > lld-link: error: could not open \’uuid.lib\’: no such file or directory

    uuid.lib is missing within .7z file

      • 1. When I try to compile & run “helloWorld” example, nothing seems to happen: in the VSCodium terminal I only see

        * Executing task in folder argentum-demo: bin\run-release.bat helloWorld
        * Terminal will be reused by tasks, press any key to close it.

        I see no sys_log output.

        2. When I try to debug I get:

        thread ‘main’ panicked at ‘called `Result::unwrap()` on an `Err` value: “Could not load \”C:/!code/ag/argentum-demo/bin/liblldb.dll\” (err=0x0000007E)”‘, adapter\codelldb\bin/main.rs:57:57
        note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
        Debug adapter exit code=101 (0x65), signal=null.

        I have VSCodium v1.92.1.24225, CodeLLDB v1.10.0

        • I’ve never worked with `VSCodium` so it can’t tell much about it. For the start I’d suggest to run the `argentum-demo\runme.bat` and check if it can build and run examples.
          If not, try manually execute `argentum-demo\bin>agc –help`, `run-release.bat helloWorld`, or manually execute compiler and/or linker steps from this `run-release.bat`.
          If these steps succeeded, check if “C:/!code/ag/argentum-demo/bin/liblldb.dll” is a valid path to the actual dll.
          There is another way to debug argentum programs – with MSVisual studio (b/c on windows it produces compatible PDBs): https://aglang.org/build-argentum-from-sources-on-windows-2/#dbg

          • `argentum-demo\runme.bat` only displays sources, I don’t see any *.exe
            `argentum-demo\bin>agc –help` shows nothing
            `run-release.bat helloWorld` doesn’t produce any visible result
            `.\agc -src “..\ag” -start helloWorld -O3 -o “..\apps\helloWorld.obj”` doesn’t produce any visible result

            • If `agc` shows nothing there is something wrong with `bin\agc.exe`. Let’s check:
              1. Is this Windows 10 or 11?
              2. Is it x86-64 machine?
              3. Is agc.exe extracted from https://github.com/karol11/argentum/releases/download/win-demo-v0.0.16/argentum-demo.7z ?
              4. Run it from cmd.
              5. Check for malware/viruses that could patch exe-file at the the moment of extraction.
              6. Check for malware protector/antivirus alerts. They might report false positive and/or quarantine this executable.
              7. In the rear case of clean windows installation agc.exe might not work with a message_box like vcruntime140_1.dll not found, it can be fixed with Installation of the “Microsoft Visual C++ 2015 Redistributable” from the official MS website. Though it doesn’t look like your case.

              • Thanks. I should have looked at the windows event log. Installing a proper version of vc++ redistributable resolved the first problem. Now compiling works. But the debugging still doesn’t work (the same error)

Leave a Reply

Your email address will not be published. Required fields are marked *