외부 접근
external
, 혹은 "FFI" (외부 함수 인터페이스), 혹은 간단하게 "연동"이라 부르는 것은 Reason이 C나 JavaScript와 같은 다른 언어와 어떻게 소통하는지에 대한 것입니다.
Imagine writing a let binding, but with its body omitted and its (mandatory) type written down:
external myCFunction: int => string = "theCFunction";
Note: external
s can only be at the top level, or inside a module definition. You can't declare them in e.g. a function body.
사용
You'd use an external value/function as if it was a normal let binding.
For more infos on how to link up your C functions within your Reason application, have a look at the Dealing with foreign libraries section in the dune
build system docs.