Skip to content

Latest commit

 

History

History
54 lines (40 loc) · 3.03 KB

File metadata and controls

54 lines (40 loc) · 3.03 KB

Scala Native Examples

Welcome to the Scala Native examples! This repository provides a progressive, step-by-step curriculum designed to help you master Bazel for buliding Scala Native applications.

Each example is a self-contained Bazel module that focuses on a specific set of concepts, building upon the previous ones.

🎓 Learning Curriculum

Learn the fundamental building blocks of a Scala Native project in Bazel.

Explore features that allow you to write high-performance code close to the hardware.

  • 01-zone-allocator: Efficient memory management using Zones.
  • 02-pointers: Manual memory management and pointer arithmetic.
  • 03-c-structs: Working with C-style data structures directly in Scala.
  • 04-posix-bindings: Interacting with the underlying operating system using standard POSIX APIs.
  • 05-intrinsics: Accessing platform-specific low-level instructions.

Master the art of calling code written in other native languages.

  • 01-c-basic: Simple Foreign Function Interface (FFI) calls to C.
  • 02-c-structs-and-strings: Passing complex data types between Scala and C.
  • 03-c-advanced: Advanced patterns like callbacks and opaque pointers.
  • 04-cpp: Interfacing with C++ code via C wrappers.
  • 05-rust: seamless integration with the Rust ecosystem.
  • 06-zig: Using Zig as a modern systems language with Scala Native.

🚀 How to Run

To run any example, navigate to its directory or use the full Bazel label from the root. For example, to run the "Hello World" example:

# From the project root
bazel run //examples/01-basics/01-hello-world:hello

To run tests:

bazel test //examples/01-basics/03-testing:test

🛠️ Requirements

See the root README.md for detailed requirements, including Bazel version and toolchain setup.