Bug 5610 – std.getopt.getopt Access Violation

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2011-02-18T08:25:00Z
Last change time
2011-05-24T19:24:35Z
Assigned to
nobody
Creator
golovanov_alexey

Attachments

IDFilenameSummaryContent-TypeSize
917geopt_test.dsmallest testcasetext/plain100

Comments

Comment #0 by golovanov_alexey — 2011-02-18T08:25:00Z
Created attachment 917 smallest testcase program using std.getopt and started with non-english option (especially prepended by '-') crushes with error: object.Error: Access Violation. Environment: Windows XP SP3 DMD 2.052 Command line: getopt_test.exe -файл Output: object.Error: Access Violation
Comment #1 by andrej.mitrovich — 2011-05-24T19:24:35Z
I'm testing this on v2.053. I suggest you upgrade to this version, it will give you nice stacktraces and a more useful error message. getopt only accepts a single argument with a single dash. You could pass a single unicode character if you want to e.g.: getopt_test.exe -ф And you'll get: getopt.d(411): Unrecognized option -ф which just means you have to write the code to handle such a case, but it works. Your multi-argument call will work if you prepend two dashes: import std.getopt; void main(string[] args) { bool test; getopt(args, "файл", &test); assert(test); } getopt_test.exe --файл So I'm closing this down, unless you find the bug persists.