haxiomic / haxe-c-bridge

Easily interact with haxe classes from C with an automatically generated C header
MIT License
51 stars 5 forks source link

Expose functions generated by another @:build / @:autobuild macro? #39

Closed datee closed 2 years ago

datee commented 2 years ago

Hi! So, i have a build macro that generates some functions for me on a class and im trying to get this exposed to haxe-c-bridge.

I'm getting code completion on the generated functions and looking at the source they are there too. But they are not being picked up and exposed in the generated .h file from haxe-c-bridge... So would this be an issue of autobuild order problems? - i've tried several ways of doing it but its not really helping.

Any good ideas here ? :)

haxiomic commented 2 years ago

Hmm this is interesting, I would expect macro fields to be picked up because HaxeCBridge waits until after typing to generate fields, but it could be useful to put a trace in there and a trace in your macro to check the order https://github.com/haxiomic/haxe-c-bridge/blob/ad92e923973ac923916348aaf89685b4e477829a/HaxeCBridge.hx#L141

Could you create a minimal repro?

datee commented 2 years ago

So i checked the sequence, and the Context.onAfterTyping in HaxeCBridge runs AFTER my macros. But it doesnt pick up the functions... will try to put together a test for you.

[Edit : seems the error was on my side - sorry about that, and thanks for the help! 👍 ]

haxiomic commented 2 years ago

Ahh good to hear, ty for the update :]