Packages

README

mojo-libc is a library that provides access to the C standard library functions in Mojo.

Getting Started

The only dependency for libc is Mojo.

You can install Mojo following the instructions from the Modular website.

Once you have created a Mojo project using the magic tool,

If you are using the magic CLI

Install the libc library by running the following command:

magic add libc

If you have a Mojo project with a toml file

  1. Add the libc dependency to your toml file, e.g:
    [dependencies]
    libc = ">=0.1.13"
  2. Run magic install at the root of your project, where the toml file is located
  3. libc should now be installed as a dependency. You can import libc functions from the library, e.g:
    from libc import socket

Supported Functionality

Basic socket connections

See the examples in examples/sockets/ directory.

Basic file system operations

See the examples in examples/files/ directory.

Building the project

To build the project, execute the following command:

./scripts/build.sh

Running the tests

To run the tests, execute the following command:

./scripts/run-tests.sh

DETAILS

RUN (INSTALL MAX FIRST)

magic add libc

MAX VERSION COMPATIBILITY

25.2

CREATED BY

TAGS

C

|

sockets

|

files
Submit your own package