Converting C .h Files to D Modules

Andrej Mitrovic andrej.mitrovich at gmail.com
Tue Mar 20 18:09:47 PDT 2012


On 3/21/12, Pedro Lacerda <kanvuanza at gmail.com> wrote:
> Ouch, void* is the same in both languages, sorry. I addressed a new problem:
>
> typedef struct SomeFunctions {
>     void *(*funcA)(char*, size_t);
>     void *(*funcB)(void);
> } SomeFunctions;
>
> How do I convert that functions references into an D struct?

extern(C)
struct SomeFunctions {
    void function(char*, size_t) funcA;
    void function() funcB;
}

Use HTOD (http://dlang.org/htod.html) if you can to convert .h to .D
(it's Windows-only but might be usable via Wine).


More information about the Digitalmars-d-learn mailing list