#Why am I getting an error finding Elixir functions in this simple example of FFI?

1 messages · Page 1 of 1 (latest)

zealous tapir
#

I've got a simple module in a new project:

external fn puts(String) -> Nil =
  "Elixir.IO" "puts"

pub fn main() {
  "hello, world"
  |> puts
}

However, when I run it via gleam run, i see the following:

$ gleam run
  Compiling stuff
   Compiled in 0.26s
    Running stuff.main
exception error: undefined function 'Elixir.IO':puts/1%  

What have I do incorrectly?

tulip girder
zealous tapir
#

Ah, I see. Thanks.

#

Yep, adding an empty .ex file solved the problem. Thanks!