Using libraries
Adding libraries to your project
Installing libraries
The library installation process is very simple. Open a terminal in the project's root directory and run this command:
CaffeineC lib info vyPal/cffc-std
You will see a banner similair to this one:
--------------------------------------------------
Package Details
--------------------------------------------------
Name : std
Description : The CaffeineC standard library
Version : 1.0.7
Main File : src/main.cffc
Author : vyPal
License : GPL-3.0
--------------------------------------------------
This is the package details for the CaffeineCnec standard library.
You can install it and add it to your project by running this command:
CaffeineC install vyPal/cffc-std
Using installed library
Congrats on installing the CaffeineC standard library! But for it to be useful, we have to use it in our program. Open the main.cffc
file from the example project, and make these changes:
package main;
-extern func printf(format: *i8): void;
+import "vyPal/cffc-std/io";
func main(): i64 {
printf("Hello, world!\n");
return 0;
}
With this line you have imported the io.cffc
file from the vyPal/cffc-std
library. This file includes many other functions besides the printf
function
Last updated
Was this helpful?