Using Faasm with External Projects

To compile projects outside the Faasm source tree you need to install the Faasmlibrary and emulator to your system. This allows you to compile and run natively.

  1. inv libs.native

This installs to /usr/local/faasm/install/. You can link to libfaasm andlibemulator from there, e.g. with a file at hello.cpp:

  1. #include <faasm/faasm.h>
  2. #include <stdio.h>
  3.  
  4. FAASM_MAIN_FUNC() {
  5. printf("Hi external\n");
  6. return 0;
  7. }

You can do:

  1. clang++ hello.cpp -I /usr/local/faasm/install/include -L/usr/local/faasm/install/lib -lfaasm -lemulator
  2. ./a.out

This should print Hi external.

Compiling to wasm

To compile to wasm you need to set up the toolchain:

TBC