Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joshnuss/elixir-ffi
Foreign Function Interface (FFI) for Elixir
https://github.com/joshnuss/elixir-ffi
elixir ffi
Last synced: 4 days ago
JSON representation
Foreign Function Interface (FFI) for Elixir
- Host: GitHub
- URL: https://github.com/joshnuss/elixir-ffi
- Owner: joshnuss
- Created: 2015-09-21T22:52:17.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-09-17T04:20:47.000Z (about 6 years ago)
- Last Synced: 2024-11-01T18:51:40.244Z (11 days ago)
- Topics: elixir, ffi
- Language: Elixir
- Size: 18.6 KB
- Stars: 56
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
FFI
===*** Warning: Turns out this is a really bad idea, do not use! When the BEAM calls native functions it needs to know how many reductions should be used. Otherwise calling a long running function can break the scheduling completly, because with this approach a long running function is considered 1 reduction ***
An easy way to call external functions (e.g. C functions) from [Elixir](https://github.com/elixir-lang/elixir).
Inspired by [Ruby's FFI](https://github.com/ffi/ffi)
** This is alpha software **
## Example Program
```elixir
defmodule MyLib do
use FFI.Library, name: "libstdc++.so.6"attach_function :puts, [:string], :int
endMyLib.puts("Hello World from C stdlib")
```## Installation
The package can be installed by adding `ffi` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:ffi, git: "https://github.com/joshnuss/elixir-ffi.git"}]
end
```## Running Examples
```shell
mix run examples/basic.exs
```## License
MIT