
Mojo's libc support
README
mojo-libc is a library that provides access to the C standard library functions in Mojo.
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,
Install the libc library by running the following command:
magic add libctoml filelibc dependency to your toml file, e.g:
[dependencies]
libc = ">=0.1.13"magic install at the root of your project, where the toml file is locatedlibc should now be installed as a dependency. You can import libc functions from the library, e.g:
from libc import socketSee 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.shDETAILS