作者: Jeremy Yallop , David Sheets , Anil Madhavapeddy
DOI: 10.1016/J.SCICO.2017.04.002
关键词:
摘要: Foreign function interfaces (FFIs) between high-level languages and system libraries typically intertwine the actions of describing interface a library selecting binding strategy for linking to it. This tight coupling makes it difficult programmers switch different strategies, discourages development new approaches binding, since more exotic are unlikely attract sufficient users justify cost development. We present Cmeleon, replacement standard OCaml FFI that exposes typed constructors correspond operations type algebra C, strategies interpret this structure as separate program stages. Cmeleon parameterises external calls across isolating descriptions from choices relating call construction (code generation vs dynamic frames), concurrency style (blocking, cooperatively or preemptively threaded), separation (in-process, address space network connection). flexibility enables significant code reuse bindings in many contexts, rapid interactive REPL production deployments with generated privilege separation. has been used past two years bind broad variety real-world libraries, entirely supplants need low-level C vast majority applications.