From 6ffa064069cfaea8448278a74f947cf805a646de Mon Sep 17 00:00:00 2001 From: Josh Nussbaum Date: Sun, 20 Sep 2015 21:16:39 -0400 Subject: [PATCH] Update FFI.Library to use FFI.call --- lib/ffi/library.ex | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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