Hi,
I have a C variadic function (passed from C code into my D code via
function pointer) that I need to call with a static array.
So according to the D documentation, static arrays are passed by value
in D2 and by reference in C and D1.
(Even though http://dlang.org/abi.html claims "Static ar
On Sunday, 20 July 2014 at 16:00:41 UTC, Daniel Gibson wrote:
Hi,
I have a C variadic function (passed from C code into my D code
via function pointer) that I need to call with a static array.
So according to the D documentation, static arrays are passed
by value in D2 and by reference in C a
Daniel Gibson:
For "normal" functions http://dlang.org/interfaceToC.html tells
me to add a "ref" in the function signature, to tell D to pass
it by reference (couldn't this be implicit for extern (C)
functions?)
I don't know why D isn't adapting such things to the needs of C.
Bye,
bearophil
Am 20.07.2014 18:37, schrieb bearophile:
Daniel Gibson:
For "normal" functions http://dlang.org/interfaceToC.html tells me to
add a "ref" in the function signature, to tell D to pass it by
reference (couldn't this be implicit for extern (C) functions?)
I don't know why D isn't adapting such t
"Daniel Gibson" wrote in message news:lqh3vb$c2b$1...@digitalmars.com...
* passing stuff to the function is done as C expects it (not done,
also: are there other cases than the static array one that are
different?)
Dynamic arrays.
D used to allow passing static and dynamic arrays to
Am 21.07.2014 06:07, schrieb Daniel Murphy:
"Daniel Gibson" wrote in message news:lqh3vb$c2b$1...@digitalmars.com...
* passing stuff to the function is done as C expects it (not done,
also: are there other cases than the static array one that are
different?)
Dynamic arrays.
D used t
"Daniel Gibson" wrote in message news:lql6ec$1rqk$1...@digitalmars.com...
>
> printf("Hello %s\n", "segfault");
If the compiler did the right thing for extern (C) functions (i.e.
implicitly passing "segfault" by reference), this shouldn't cause a
segfault.
Whether or not passing the point
Daniel Murphy:
Giving an error and forcing you to be explicit about what
exactly you wanted is the best that's possible.
OK. This is far better than silent bugs :-)
Bye,
bearophile
Am 22.07.2014 11:01, schrieb Daniel Murphy:
Old D code (from the 32-bit only days) used to do this successfully:
printf("Hello %.*s\n", "segfault");
So it relied on both the length and pointer being passed. Unfortunately
this was done quite a lot, so simply changing the rules so string
litera
On Tuesday, 22 July 2014 at 13:28:27 UTC, Daniel Gibson wrote:
Am 22.07.2014 11:01, schrieb Daniel Murphy:
Old D code (from the 32-bit only days) used to do this
successfully:
printf("Hello %.*s\n", "segfault");
So it relied on both the length and pointer being passed.
Unfortunately
this
10 matches
Mail list logo