This document describes the directory structure and organization of the LeanCLR project.
leanclr/
├── src/
│ ├── runtime/ # LeanCLR runtime core
│ ├── libraries/ # Base class libraries
│ ├── tools/ # Command-line tools
│ ├── samples/ # Sample projects
│ └── tests/ # Unit tests
├── docs/ # Documentation
└── tools/ # Build utilities
Note: Demo examples have been moved to a separate repository: leanclr-demo
Directory: src/runtime
Core implementation of the LeanCLR runtime. This is the heart of the project.
| Directory | Description |
|---|---|
| metadata | ECMA-335 metadata parsing and representation |
| vm | Virtual machine core (type system, method invocation, runtime state management) |
| interp | IL interpreter and IR interpreter implementation |
| gc | Garbage collector (in development) |
| icalls | Internal calls implementation |
| alloc | Memory allocators (metadata allocation, managed object allocation) |
| intrinsics | Intrinsic method implementations |
| os | OS abstraction layer |
| utils | Utility functions and helpers |
| misc | Miscellaneous components |
Directory: src/libraries
Contains .NET Framework base class libraries required by the runtime:
- mscorlib.dll - Core runtime library
- System.dll - System namespace types
- System.Core.dll - LINQ and additional system types
Note: Only .NET Standard 2.x / .NET Framework 4.x core libraries are verified.
Directory: src/tools
A command-line tool with embedded LeanCLR runtime that can directly load and run .NET assemblies.
Basic Usage:
lean [options] <dll_name> [-- <dll_args>...]Options:
| Option | Description |
|---|---|
-l, --lib-dir <dir> |
Add a DLL search path (can be used multiple times) |
-e, --entry <entry> |
Specify entry method in format Namespace.Type::Method |
-h, --help |
Display help information |
Example:
lean -l dotnetframework -l libs CoreTests -e test.App::MainDirectory: src/samples
| Project | Description |
|---|---|
| startup | Win64 native platform sample project |
| lean-wasm | WebAssembly platform sample project |
Directory: src/tests
Unit test framework and test cases for the LeanCLR runtime.
| Directory | Description |
|---|---|
| basic_test_runner | C++ test runner (loads and executes managed test assemblies) |
| managed | C# managed test projects |
See Test Framework Documentation for details on how to add test cases.
Directory: docs
Project documentation including build guides, embedding instructions, and API references.
Directory: tools
Build and development utilities:
- clang-format - Code formatting configuration