[Issue 8887] static arrays passed by value in extern C/C++ functions should not compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Nov 8 02:37:55 PST 2014


https://issues.dlang.org/show_bug.cgi?id=8887

Mike Parker <aldacron at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aldacron at gmail.com

--- Comment #14 from Mike Parker <aldacron at gmail.com> ---
(In reply to Dicebot from comment #7)
> The fact that `ref` parameters are allowed for extern(C) functions is even
> more bizzare than the fact that static array arguments crash programs. Need
> to check if it works, I would have never guessed to even try it.
> 

This is documented. See the section "Passing D Array Arguments to C Functions"
at http://dlang.org/interfaceToC.html. 

If anyone wants examples of existing code that will be broken by this, see
Derelict. DerelictODE in particular, in which the matrix and vertex types are
typedefed on the C side as fixed-size arrays and passed as such to all the
functions that use them. Personally, I don't see the problem with prototyping
such C functions with ref. I hope it *doesn't* change.

--


More information about the Digitalmars-d-bugs mailing list