CaffeineC
GitHubBlog
  • CaffeineC
  • Getting started
    • Installing the compiler
    • Creating a new project
    • Using libraries
  • High level functionality
    • Classes
    • Arrays
  • Advanced principles
    • Optimizing the compiler
Powered by GitBook
On this page
  • Installing libraries
  • Using installed library

Was this helpful?

  1. Getting started

Using libraries

Adding libraries to your project

PreviousCreating a new projectNextClasses

Last updated 1 year ago

Was this helpful?

If you haven't created a project yet, please follow .

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

this tutorial