I'm trying to make an installer application in D. I've checked with various hashes and the file it's outputting is different to the original, and therefore Windows is saying it's not a valid Win32 application. I'm sure it's me doing something wrong and not DMD's fault. Any help is appreciated.

Here's the code:

-----installer.d-----
import std.stdio;

immutable auto testFile = import("test.exe");

void main()
{
    File f = File("installDir\\test.exe", "w");
    f.write(testFile);
    f.close;
}
---------------------

-----test.d-----
import std.stdio;

void main()
{
    writeln("Hello World");
}
----------------

I'm compiling using:
dmd test.d
dmd installer.d -J%cd%

DMD is version 2.060, Windows 7 64 bit.

Reply via email to