diff --git a/lib/ffi/library.ex b/lib/ffi/library.ex index b09cc61..008b75b 100644 --- a/lib/ffi/library.ex +++ b/lib/ffi/library.ex @@ -14,16 +14,13 @@ defmodule FFI.Library do defmacro attach_function(name, arguments, return_type) do quote do - def unquote(name)(pid, params) do - args = {unquote(name), params} + def unquote(name)(params) do + definition = {ffi_lib, + unquote(name), + unquote(arguments), + unquote(return_type)} - GenServer.call(pid, args) - end - - def handle_call({unquote(name), params}, _from, state) do - IO.puts ffi_lib - a = IO.puts(params) - {:reply, a, state} + FFI.call(definition, params) end end end