From: Hoehle, Joerg-C. <Joe...@t-...> - 2003-07-10 07:57:08
|
Hi, Sam answered: >yes, (c-union #) ==> crash, (c-ptr (c-union #)) ==> works I wrote >Maybe also the testcase is just incorrect, and I should not cast an >int (*)(int) --what c-self aka ffi_identity() really is-- >into a xyz (*)({union a|b|c}) function? I've come overnight to the (preliminary) conclusion that this casting is indeed incorrect. Bruno? As a result, the c-union passing test cases should be removed -- but not the (c-ptr (c-union)) ones. They can not portably work with the local uintL ffi_identity(uintL arg) { return arg; } function. [Maybe Mingw where the crashes are seen uses the so-called non-reentrant pcc-struct return convention?] This means a little less statement coverage in foreign.d, but so what. Maybe somebody on mingw may want to test this case using a module which contains a real union passing function and report results? I mean interfacing to something like char* test_mingw1(union {char* s1; int i2;} arg1) {return arg1.s1;} Regards, Jorg Hohle. |