Calling C function with static array includes length and pointer

torhu no at spam.invalid
Mon Jun 21 15:00:27 PDT 2010


On 21.06.2010 23:30, mwarning wrote:
> Hi,
>
> I try to pass a static array to a variadic C function.
> Looks like the array is passed by values as expected,
> but the length and pointer are prepended, too.
> Is this intentional or a bug?
>
> http://pastebin.com/6ejFF37j

I believe this works as intended.  And arrays in D 1 are *not* passed by 
value, ie. the data is not copied.

 From www.digitalmars.com/d/1.0/arrays.html:

"a string literal is passed as a (length,pointer) combination to 
variadic parameters"

In other words, use stack.ptr if you want just the pointer.


More information about the Digitalmars-d mailing list