# Using UFUNCTION within a macro

**URL:** <https://forums.unrealengine.com/t/using-ufunction-within-a-macro/372292>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [October 3, 2016, 7:27am UTC](https://forums.unrealengine.com/t/using-ufunction-within-a-macro/372292 "2016-10-03T07:27:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![xAnnihilationx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xAnnihilationx](https://forums.unrealengine.com/u/xAnnihilationx)\
**Post date:** [October 3, 2016, 7:27am UTC](https://forums.unrealengine.com/t/using-ufunction-within-a-macro/372292/1 "2016-10-03T07:27:00Z")

</div>

I have a bit of code that looks like

```
#define QUEST_WRAPPER_PARAM_DEF(RETURN_TYPE,FUNCTION, ...) \
UFUNCTION(BlueprintCallable, Category = "Quest System", meta = (DisplayName = #FUNCTION ))\
static RETURN_TYPE Receive##FUNCTION(UObject* WorldContextObject, __VA_ARGS__ );\
RETURN_TYPE FUNCTION( __VA_ARGS__ );

```

And it compiles fine but the UFUCTION markup seems to not work : /

---

<div class="post-metadata">

**Author:** ![xAnnihilationx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xAnnihilationx](https://forums.unrealengine.com/u/xAnnihilationx)\
**Post date:** [October 3, 2016, 7:42am UTC](https://forums.unrealengine.com/t/using-ufunction-within-a-macro/372292/2 "2016-10-03T07:42:25Z")

</div>

it really doesn’t like this

```
UFUNCTION(BlueprintCallable, Category = "Quest System", meta = (DisplayName = HorDor))
QUEST_WRAPPER_PARAM_DEF(void,HorDor)

```

welp that’s no fun.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_aa2a7fa1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_aa2a7fa1](https://forums.unrealengine.com/u/anonymous_user_aa2a7fa1)\
**Post date:** [October 3, 2016, 1:05pm UTC](https://forums.unrealengine.com/t/using-ufunction-within-a-macro/372292/3 "2016-10-03T13:05:56Z")

</div>

Unless someone else says otherwise, UNFUNCTION wouldn’t be compatible with a Macro because, there’s no function to reference! When you use a macro, it just injects that code, at compile time, where you call it. So there’d be no function address or anything.

---

<div class="post-metadata">

**Author:** ![xAnnihilationx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xAnnihilationx](https://forums.unrealengine.com/u/xAnnihilationx)\
**Post date:** [October 3, 2016, 9:00pm UTC](https://forums.unrealengine.com/t/using-ufunction-within-a-macro/372292/4 "2016-10-03T21:00:24Z")

</div>

It also seems like the markup is applied before the macros are expanded so you can’t even take UFUNCTION out of the macro and have it work. As a lispy programmer this makes me sad.
