Thread overview |
---|
February 22, 2015 Passing variadic arguments to C | ||||
---|---|---|---|---|
| ||||
Is this possible? Example: ---- void foo(Args...)(auto ref Args args) { sprintf(str.ptr, fmt.ptr, args); } ---- |
February 22, 2015 Re: Passing variadic arguments to C | ||||
---|---|---|---|---|
| ||||
Posted in reply to Foo | On Sunday, 22 February 2015 at 17:09:27 UTC, Foo wrote:
> Is this possible?
>
> Example:
> ----
> void foo(Args...)(auto ref Args args) {
> sprintf(str.ptr, fmt.ptr, args);
> }
> ----
yes
|
February 22, 2015 Re: Passing variadic arguments to C | ||||
---|---|---|---|---|
| ||||
Posted in reply to anonymous | On Sunday, 22 February 2015 at 17:15:06 UTC, anonymous wrote:
> On Sunday, 22 February 2015 at 17:09:27 UTC, Foo wrote:
>> Is this possible?
>>
>> Example:
>> ----
>> void foo(Args...)(auto ref Args args) {
>> sprintf(str.ptr, fmt.ptr, args);
>> }
>> ----
>
> yes
I get the error, that I cannot pass a dynamic array to a C function.
|
February 22, 2015 Re: Passing variadic arguments to C | ||||
---|---|---|---|---|
| ||||
Posted in reply to Foo | On Sunday, 22 February 2015 at 17:20:23 UTC, Foo wrote:
> On Sunday, 22 February 2015 at 17:15:06 UTC, anonymous wrote:
>> On Sunday, 22 February 2015 at 17:09:27 UTC, Foo wrote:
>>> Is this possible?
>>>
>>> Example:
>>> ----
>>> void foo(Args...)(auto ref Args args) {
>>> sprintf(str.ptr, fmt.ptr, args);
>>> }
>>> ----
>>
>> yes
>
> I get the error, that I cannot pass a dynamic array to a C function.
My fault, the reason was that Args contains strings. ;)
|
Copyright © 1999-2021 by the D Language Foundation