www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Error: 0xc0000005, Dmd Win 64

reply "Michael" <pr m1xa.com> writes:
Code works good on Win 32, but at start on Win 64 I got:

Exception code: 0xc0000005
Fault offset: 0x00000000000132c5
void main(string[] args) { auto workDir = "build_tmp"; auto currDir = getcwd(); string[] src; string[] obj; string cfg = "build.json"; Compiler compiler; DirEntry[] files; if (args.length > 1 && !args[1].empty) if (exists(args[1])) cfg = args[1]; try { compiler = cfg.readCompilerInfo(); } catch (Exception e) { writeln(e.msg); } if (compiler is null) return; if (!exists(compiler.srcDestination)) { writeln("Not found: <" ~ compiler.srcDestination ~ ">."); return; } files = dirEntries(compiler.srcDestination, "*.d", SpanMode.depth).array; if (files is null) { writeln("No sources."); return; } foreach(f; files) { src ~= absolutePath(f.name); obj ~= buildNormalizedPath(workDir, setExtension(f.name, "obj")); } for (size_t i = 0; i < src.length; i ++) { if (!obj[i].dirName().exists()) obj[i].dirName().mkdirRecurse(); compiler.compile(src[i], obj[i]).executeInShell(); } compiler.build(obj).executeInShell(); }
Mar 08 2013
next sibling parent reply "Michael" <pr m1xa.com> writes:
On Friday, 8 March 2013 at 13:25:42 UTC, Michael wrote:
 Code works good on Win 32, but at start on Win 64 I got:

Exception code: 0xc0000005
Fault offset: 0x00000000000132c5
If "auto currDir = getcwd();" commented, error is not appear. getcwd broken on win 8 x64?
Mar 08 2013
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 08.03.2013 18:00, Michael wrote:
 On Friday, 8 March 2013 at 13:25:42 UTC, Michael wrote:
 Code works good on Win 32, but at start on Win 64 I got:

 Exception code: 0xc0000005
 Fault offset: 0x00000000000132c5
If "auto currDir = getcwd();" commented, error is not appear. getcwd broken on win 8 x64?
I don't see it crashing over here. What version of dmd are you using? Do you have some extra long cwd or some non-standard characters in your path?
Mar 09 2013
next sibling parent reply "Michael" <pr m1xa.com> writes:
 I don't see it crashing over here. What version of dmd are you 
 using? Do you have some extra long cwd or some non-standard 
 characters in your path?
Usual path is "D:\Dev\M1xA\D" OS: Win 8 Pro 64 bit DMD 2.062 VS 2012 Express for Desktop Code from Phobos successfully compiles, but crashes on 64 bit.
Mar 09 2013
parent reply Rainer Schuetze <r.sagitario gmx.de> writes:
On 09.03.2013 09:42, Michael wrote:
 I don't see it crashing over here. What version of dmd are you using?
 Do you have some extra long cwd or some non-standard characters in
 your path?
Usual path is "D:\Dev\M1xA\D" OS: Win 8 Pro 64 bit DMD 2.062 VS 2012 Express for Desktop Code from Phobos successfully compiles, but crashes on 64 bit.
I can reproduce it with VS2012, but not with VS2008 (cannot test VS2010 atm). It seems some incompatibility with the MS runtime library LIBCMT.lib.
Mar 09 2013
parent reply "Michael" <pr m1xa.com> writes:
Crash also occurs when

int[] a;
a.length = 10;

So, it's maybe something wrong with ms c runtime of VS 2012.

Just installed Update 2 for VS 2012, not helps.
Mar 09 2013
parent Brad Roberts <braddr puremagic.com> writes:
On 3/9/2013 7:11 AM, Michael wrote:
 Crash also occurs when
 
 int[] a;
 a.length = 10;
 
 So, it's maybe something wrong with ms c runtime of VS 2012.
 
 Just installed Update 2 for VS 2012, not helps.
Please make sure that a bug report is filed: http://d.puremagic.com/issues/ Thanks, Brad
Mar 09 2013
prev sibling parent "Michael" <pr m1xa.com> writes:
This code works good.

string cwd()
{
     import core.sys.windows.windows;
     wchar[] ret = new wchar[10240];
     auto n = GetCurrentDirectoryW(to!DWORD(ret.length), ret.ptr);
     return ret[0 .. n].to!string();
}

Also similar problem/crash occurs in "dirEntries" on 64 bit.
Mar 09 2013
prev sibling parent "Michael" <pr m1xa.com> writes:
So, there is problem in toUTF8 in std.utf "toUTF8(in wchar[] s)".

string cwd()// copied from phobos
{
     writeln("start");
     import core.sys.windows.windows;
     writeln("buff");
     wchar[] ret = new wchar[10240];
     writeln("call");
     auto n = GetCurrentDirectoryW(to!DWORD(ret.length), ret.ptr);
     writeln("return");
     return ret[0 .. n].to!string();
}

Works as expected on both win32 and win64.
Mar 08 2013