Thread overview | |||||
---|---|---|---|---|---|
|
December 12, 2013 What is the common way of porting opaque types in C header files? | ||||
---|---|---|---|---|
| ||||
I have a lot of opaque types in C headers i'm porting to D. What is the best way to handle these? Would you just use void pointers? In the below example Tcl_AsyncHandler_ is not defined anywhere. C: typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler; D: alias void* Tcl_AsyncHandler; |
December 13, 2013 Re: What is the common way of porting opaque types in C header files? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gary Willoughby | On 12/13/2013 7:52 AM, Gary Willoughby wrote:
> I have a lot of opaque types in C headers i'm porting to D. What is the
> best way to handle these? Would you just use void pointers?
>
> In the below example Tcl_AsyncHandler_ is not defined anywhere.
>
> C:
> typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
>
> D:
> alias void* Tcl_AsyncHandler;
>
D:
struct Tcl_AsyncHandler_;
alias Tcl_AsyncHandler = Tcl_AsyncHandler_*;
|
December 13, 2013 Re: What is the common way of porting opaque types in C header files? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Mike Parker | On Friday, 13 December 2013 at 01:20:41 UTC, Mike Parker wrote:
> On 12/13/2013 7:52 AM, Gary Willoughby wrote:
>> I have a lot of opaque types in C headers i'm porting to D. What is the
>> best way to handle these? Would you just use void pointers?
>>
>> In the below example Tcl_AsyncHandler_ is not defined anywhere.
>>
>> C:
>> typedef struct Tcl_AsyncHandler_ *Tcl_AsyncHandler;
>>
>> D:
>> alias void* Tcl_AsyncHandler;
>>
> D:
> struct Tcl_AsyncHandler_;
> alias Tcl_AsyncHandler = Tcl_AsyncHandler_*;
Ah right, thanks. I didn't know D allows such types.
|
Copyright © 1999-2021 by the D Language Foundation