Hi !

I defined a macro like this:

```
defmodule Test do
  defmacro __using__ do
    quote do
      require Test
      import Test
    end
  end

  defmacro my_macro do
    quote do
      Gernserver.call() # generic server call from other module
    end
  end
end
```

I have this code inside a lib which I am building. When testing this lib in 
a different application I get a compile error on the file which has the 
`use Test`.

Error: `exited in: GenServer.call ...` `exit no process` (on the line of 
the my_macro call, more specifically on the genserver call). As if the 
genserver was not running, and it is not because it is compile time.

Adding a simple Application.ensure_all_started(:lib_name) to the __using__ 
macro seems to fix the problem. But then again, at compile time the code 
shouldn't be running, am I right ? Or is here something I am not seeing ? 
Maybe I can not use genserver calls on a macro ? Or is it a bug ?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/211750d3-4d67-402b-a9d2-5b93d65f3b18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to