HaxeFoundation / HaxeFoundation/hxcpp

[cppia] Replacing functions in main source through cppia causes crash

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

Description

Haxe 4.1.1 and Windows 10. I was recommended on the forum to come here.

Main program code
```
class ToolCore
{
public static var replaceable_func:Void -> Void;

public function new()
{
replaceable_func = null_action_safety;

Host.runFile("./plugins/tools/TestTool.cppia"); //<- Crash happens here.
}

public static function null_action_safety():Void {
trace("Function has not been replaced");
}

}
```
cppia code
```
class TestTool {
static public function main() {
ToolCore.replaceable_func = () -> {trace("herpa derp"); };
}
}
```
I get the error ``Unknown function : __hxcpp_mutex_create(0)`` and nothing else. Everything compiles correctly, and I have the ``scriptable`` flag enabled. In order to accomplish the replacement so the source doesn't complain, I'm treating ``ToolCore`` as a haxelib, which I believe is an intended function.

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.