Custom([file_write,stderr]) error on windows target


I try to run a compiled Haxe project in windows, but with or
without any assets and icon (and with or without embed=“true”) I got
Custom([file_write,stderr]) error window.
I use OpenFL 2.2.1, lime 2.0.4.

Any idea?

Thanks in advance!

might be an exception?

if you add

<haxedef name="HXCPP_DEBUGGER" if="debug" />

in your application.xml
and Test Project in Debug (assuming you are using Flash Develop)
it will show where the exception is when exception is thrown

PS: HXCPP_DEBUGGER will drag performance, use it only when you are debugging

1 Like

Thanks for Your suggestion. I have got “Invalid field:blockIndent” error. The google come up with hits, and programmers say, that “-dce full” can cause this. So I removed it, and voile, the code is running fine.
Thanks again!

Was it an OpenFL file that was failing due to dead-code elimination?

I don’t know. Just the above error message appeared. No line number, or other.
I used actuate and svg library, too.

I made a round of dead-code elimination fixes a few minutes ago, PiratePig failed in several targets, but now it works properly. If you have a sample that fails with DCE full, I’d be happy to take a look :slight_smile:

There is nothing special. An SVG file, as an asset, and a TestSvg.hx, which tries to load, and display that SVG with downscale.

package view;
import format.SVG;
import openfl.Assets;
import openfl.display.Sprite;

 * Try to load and diaplay the asset SVG.
 * @author Hortobágyi, Tom
class SvgTest extends Sprite

    public function new() 
        var svg:SVG = new SVG(Assets.getText("img/tiger.svg"));
        svg.render(, 0, 0, 1200, 1200);
        this.scaleX = this.scaleY = 0.35;
        this.x = 500;

I have a small question
is it possible to make it show real exception message
not just “Custom([file_write,stderr])” ?
not really important, but it confused people when this message pop up

Okay, great.

The fixes I made are also enabling your small sample above to run with DCE full. However, it’s disappointing that the tiger is rendering black, this must be a regression in the SVG library, because it used to work.

Then again, I think the error you got had to do with a TextField, perhaps? Either way, I’m glad the above works with dead code elimination now :slight_smile:

Yep, there is one TextField. I did not supposed, that it is important, but if I comment out it, than the exe run with DCE full.

Would you mind sharing the code so I can reproduce the same error? Thanks!

Yep. Here is it. If I didn’t use this class, everything is working fine with DCE full.

import openfl.text.TextField;

 * Primitive text handling, in-app logging
 * @author Hortobágyi, Tom
class DisplayTxt
    var t:TextField;
    public function new() 
        t = new TextField();
        t.width = 200;
        t.height = 200;
        t.wordWrap = true;
        t.mouseEnabled = false;
        t.x = Config.TEXT_X_POS; // place from a config class
        t.y = 20;
        Main.STAGE.addChild(t); // stage object
        var tf = t.defaultTextFormat;
        tf.color = 0xffffff;
        tf.size = 20;
        t.defaultTextFormat = tf;
        t.text = "display";
    public function log(s:String) { t.text += "\n" + s; }
    public function setText(s:String) { t.text = s; }

Hmm, I tried using it, but it’s working, so either I already fixed the problem, or it’s in how it’s all being included.

I did a “Main” class like this:


import openfl.display.Sprite;

class Main extends Sprite {
	public static var STAGE:Dynamic;
	public function new () {
		super ();
		STAGE = stage;
		var hi = new DisplayTxt ();

And I did a “Config” class like this:

class Config {
	public static var TEXT_X_POS = 0;

In order to get it to compile, but it’s working with DCE full :smile: