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,
- Add the
mojo-communitychannel to yourmojoproject.toml, e.g:[project] channels = ["conda-forge", "https://conda.modular.com/max", "https://repo.prefix.dev/mojo-community"]
- Add
libcas a dependency:[dependencies] libc = ">=0.1.4"
- Run
magic installat the root of your project, wheremojoproject.tomlis located libcshould now be installed as a dependency. You can import libc functions from the library, e.g:from libc import socket
See the examples in examples/sockets/ directory.
See the examples in examples/files/ directory.
To build the project, execute the following command:
./scripts/build.shTo run the tests, execute the following command:
./scripts/run-tests.sh