Wrapping C that uses compiler extensions

simendsjo simen.endsjo at pandavre.com
Sat Mar 5 04:49:11 PST 2011


On 05.03.2011 08:58, "Jérôme M. Berger" wrote:
> simendsjo wrote:
>> On 04.03.2011 22:42, "Jérôme M. Berger" wrote:
>>> int main(string[] args) {
>>>      auto s1 =(); // MH MH
>>>      auto s2 =(); // OK
>>>      s2.c =ull; // OK
>>>      return 0;
>>> }
>>
>> Is part of your message gone?
>>
> 	Uh, I did not write that.

Checked the web newsinterface, and I see your post. In thunderbird I got 
another post from Tom with the subject "Struct reference returning 
function and const members" in your post...

>>> You can safely ignore the “ATTRIBUTE_FORMAT_FPTR(printf, 4, 5)”.
>>
>> That I understood :) Thanks!
>
> 	Then if the issue is with the rest of the definition, it is more or
> less equivalent to (you will need to translate the argument
> declaration too):
>
> alias size_t function (struct charset_info_st *, char *to, size_t n,
>                         const char *fmt,
>                         ...) snprintf;
>
> 		Jerome

The definition is inside a struct. I shouldn't use an alias then..?

This is the C struct:
typedef struct my_charset_handler_st
{
   // snip
   size_t (*snprintf)(struct charset_info_st *, char *to, size_t n,
                      const char *fmt,
                      ...) ATTRIBUTE_FORMAT_FPTR(printf, 4, 5);
   // snip
}

And this is my D struct:
struct my_charset_handler_st
{
   // snip
   size_t  function(charset_info_st*, char* to, size_t n,
                 const char* fmt,
                 ...) snprintf;
   // snip
}


More information about the Digitalmars-d-learn mailing list