[Issue 3604] extern(C) callable function with array parameters broken
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 11 06:40:59 PST 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3604
Steven Schveighoffer <schveiguy at yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |schveiguy at yahoo.com
--- Comment #4 from Steven Schveighoffer <schveiguy at yahoo.com> 2009-12-11 06:40:58 PST ---
What about using ref int[2] instead?
I just tested with your code modifying the signature and it works:
[steves at steveslaptop testd]$ cat bug3604.d
extern(C) int tttc(ref int[2] x);
void main() {
int[2] input;
tttc(input);
}
[steves at steveslaptop testd]$ cat bug3604c.c
#include <stdio.h>
int tttc(int x[2]) {
printf("just in C\n");
printf("x=%p\n", x);
printf("x[0]=%d\n", x[0]);
printf("x[1]=%d\n", x[1]);
printf("back from C\n");
}
[steves at steveslaptop testd]$ gcc -c bug3604c.c
[steves at steveslaptop testd]$ ../dmd2.037/linux/bin/dmd bug3604.d bug3604c.o
[steves at steveslaptop testd]$ ./bug3604
just in C
x=0xbffa06e0
x[0]=0
x[1]=0
back from C
I think this better captures the correct signature than what I suggested in the
post.
--
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