# Function generation / dynamic dispatch

**URL:** <https://forum.elixirforum.com/t/function-generation-dynamic-dispatch/13325>\
**Category:** Questions\
**Tags:** macros, behaviours\
**Created:** [March 27, 2018, 12:59am UTC](https://forum.elixirforum.com/t/function-generation-dynamic-dispatch/13325 "2018-03-27T00:59:46Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![Ripster](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ripster/32/8869_2.png) [@Ripster](https://forum.elixirforum.com/u/Ripster)\
**Post date:** [March 30, 2018, 1:33am UTC](https://forum.elixirforum.com/t/function-generation-dynamic-dispatch/13325/12 "2018-03-30T01:33:58Z")

</div>

I’ve been messing around with `require` quite a bit and still can’t seem to get it to work. What seems to be happening is `Mix.Tasks.Xref.calls()` comes up empty on first compile. If I edit what seems to be just about any file related to the router and then recompile, it comes up with a list of callers like I expect.

Doing a `require` on the router module, packet module, or even requiring the actual packet definition in the router does not seem to get it working.

I’ve started looking through the code on github for `mix xref callers` because it seems to always list out the dependency’s of `Packet` correctly (or at least the files that use it). I’m hoping that will shed some light on a possible solution.

I have to admit I’m still fairly new to elixir. If you think creating a compiler plugin is a good way to go I would love to know where I can find related documentation so I can learn more. If you don’t mind can you help point me in the right direction here?

---

_[View the full topic](https://forum.elixirforum.com/t/function-generation-dynamic-dispatch/13325)._
