SomeRanDev / reflaxe.CPP

An alternative C++ target for Haxe that generates dependent-less, GC-less C++17 code.
MIT License
72 stars 5 forks source link

@:nativeFunctionCode encountered types are not included in the output #40

Closed fourst4r closed 7 months ago

fourst4r commented 8 months ago

The following code will not #include (or generate) the output files for FooBar.

// FooBar.hx
@:valueType class FooBar {}
// Main.hx
@:nativeFunctionCode("(void){type0}")
extern function void<T>(c:Class<T>):Void;

function main() {
    void(FooBar);
}
SomeRanDev commented 8 months ago

The good news is the #include is an easy fix. The bad news... is I'm not sure how to fix FooBar not being generated. I think that might be a Haxe bug(?)

Unfortunately, there's no way for me to add classes manually since Reflaxe works during the final phase of compilation (after typing and optimization). It might be worth adding this as an issue on the Haxe github. There are functions that take classes as arguments in JavaScript, so could use a Haxe/JS example?

fourst4r commented 8 months ago

Hmm, I don't think it's a Haxe bug, because the exact same code compiled with hxcpp will generate FooBar. Unless there is something I'm missing?

SomeRanDev commented 8 months ago

OHH you might be right! Give me a bit. 🤔

SomeRanDev commented 8 months ago

OKAY! I haven't tested it, but this should be fixed now! (It might have just been really simple and I am dumb lmao)

fourst4r commented 7 months ago

Yes! Whatever you did fixed it. Thanks a bunch. 👍