Is there some pattern for using port drivers in OTP?
My plan is running some external programs for some amount of time.
Is there some pattern for using port drivers in OTP?
My plan is running some external programs for some amount of time.
Explore the Erlang documentation’s tutorial on C Ports, an essential feature that facilitates seamless integration between Erlang and C programming languages. The tutorial provides detailed insights and guidance, offering developers a comprehensive resource to understand the intricacies of C Port. You also can find useful Building C/C++ | Rebar3 documentation useful or at Erlang.mk User Guide - related to which tool for build project you want to use. Plus, you can take a look to this topic Erlang Nodes and C Nodes.
I might haved asked the wrong question. My plan is calling out for ffmpeg via open_port.
There is no specific pattern for it. There is erlexec
library that implements some convenience, but I have no personal experience with it. If you’re not planning to leverage it, several notes that I accumulated while working on similar externally running code. Most of these notes are clearly visible in OTP peer
module (otp/lib/stdlib/src/peer.erl at master · erlang/otp · GitHub).
peer
implements a gen_server
for that purpose)kill
on Unix, executed with the same open_port
approach) to control external executable behaviour)Thanks!