Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate fully qualified names for global c++ classes #1181

Open
kevinresol opened this issue Jan 25, 2025 · 0 comments
Open

Generate fully qualified names for global c++ classes #1181

kevinresol opened this issue Jan 25, 2025 · 0 comments

Comments

@kevinresol
Copy link

kevinresol commented Jan 25, 2025

Summary:
For hxcpp classes not defined in namespace, e.g. ::String, ::Array and ::Dynamic, the compiler should always generate them with the :: prefix so they are fully qualified.

Rationale:
Working with godot lately and they have a C++ classgodot::String.
If we also declare a Haxe class like this:

package godot;

class Foo {
  public function print(str:String) {}
}

the generated c++ code will look somewhat like this:

namespace godot {
  class Foo {
    void print(str:String);
  }
}

and the c++ compiler would think that the function argument is a godot::String and causing c++ compilation errors.

Alternatively:
All these global hxcpp class should be moved to the hx namespace to be consistent with other classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant