[Issue 3604] New: extern(C) callable function with array parameters broken

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 10 10:17:16 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3604

           Summary: extern(C) callable function with array parameters
                    broken
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: baryluk at smp.if.uj.edu.pl


--- Comment #0 from Witold Baryluk <baryluk at smp.if.uj.edu.pl> 2009-12-10 10:17:12 PST ---
I found a regression in 2.037. It was working in 2.032.

import core.sys.posix.unistd : pipe;

void main() {
int[2] input, output;

writefln("input: %s", input);
writefln("input.ptr: %s", input.ptr);
writefln("cast input: %s", cast(char*)input);
ttt(input);

if (pipe(input) != 0) {
  throw new Exception("can't create input pipe");
} else {
  writeln("ok");
}

}

extern(C) int ttt(int[2] x) {
  writefln("x = %s", x); 
  writefln("x[0] = %s", x[0]);
  writefln("x[1] = %s", x[1]);
  return 0;
}



this programs print:
====
input: 0 0
input.ptr: BF85E068
cast input: BF85E068
x = 0 0
x[0] = 0
x[1] = 0
object.Exception: can't create input pipe
====

but should:

====
input: 0 0
input.ptr: BF85E068
cast input: BF85E068
x = BF85E068
x[0] = 0
x[1] = 0
ok
====

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list