HaxeFoundation / HaxeFoundation/hxcpp

Generate fully qualified names for global c++ classes

Open
#1,181 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
330
Forks
227
Avg merge
2d 16h
Merged PRs (30d)
18

Description

**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++ class`godot::String`.
If we also declare a Haxe class like this:

```haxe
package godot;

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

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

```cpp
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.