c3lang / c3-web

The website for C3 made with Astro!
https://c3-lang.org/
MIT License
47 stars 22 forks source link

add a tutorial for creating a C3 library and importing it into a project or using standalone #67

Open joshring opened 1 month ago

joshring commented 1 month ago

Want a tutorial to create a simple C3 library and use it

joshring commented 2 weeks ago

Let's say you have foo.c with:

int foo_add(int x, int y) {
    int sum = 0;
    sum = x + y;
    return sum;
}

If you have a project then add:

{
  ...
  "c-sources":["foo.c"]
  ...
}

Now in your code, add:

extern int foo_add(int x, int y);

Now you can use it.