How to convert these constructs to D?

Craig Dillabaugh craig.dillabaugh at gmail.com
Sat Nov 30 19:20:39 PST 2013


On Saturday, 30 November 2013 at 14:53:35 UTC, Gary Willoughby 
wrote:
> I'm porting some C headers and wondered how would i convert the 
> following to D:
>
> #define pthread_self() GetCurrentThreadId()
>
> #define pthread_handler_t void * __cdecl
>
> typedef void * (__cdecl *pthread_handler)(void *);
>
> #define set_timespec_nsec(ABSTIME,NSEC) { \
>   GetSystemTimeAsFileTime(&((ABSTIME).tv.ft)); \
>   (ABSTIME).tv.i64+= (__int64)(NSEC)/100; \
>   (ABSTIME).max_timeout_msec= (long)((NSEC)/1000000); \
> }

Maybe you have already solved all your problems, but have you 
tried DStep with this header?  I used it on FFTW3, which is 
basically one GIANT C 100 line macro, and it 'seems' to have done 
a great job on that. However, in other cases it just seems to 
have dropped some defines altogether, so your mileage may vary.

Craig


More information about the Digitalmars-d-learn mailing list