How to convert these constructs to D?

Gary Willoughby dev at nomad.so
Sun Dec 1 10:51:50 PST 2013


On Sunday, 1 December 2013 at 03:20:49 UTC, Craig Dillabaugh 
wrote:
> 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

To be honest i didn't. The last time i tried DStep i had problems 
with compilation. I'll take another look though. I'm basically 
porting all the mysql-client headers which i thought would be 
pretty straight forward but it's taking a little more thought 
than i anticipated.


More information about the Digitalmars-d-learn mailing list