Converting C .h Files to D Modules
Pedro Lacerda
kanvuanza at gmail.com
Tue Mar 20 19:14:33 PDT 2012
On Tue, Mar 20, 2012 at 10:53 PM, dnewbie <run3 at myopera.com> wrote:
> On Wednesday, 21 March 2012 at 01:09:58 UTC, Andrej Mitrovic wrote:
>
>> 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).
>>
>
> Why not
> void* function(char*, size_t) funcA;
> void* function() funcB;
>
>
Andrej, thanks for the solution.
dnewbie, you're correct, the return type is void* instead of void.
bearophile, the extern(C) where Andrej pointed works well on gdc-4.6.2
Thanks :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20120320/cb7159fa/attachment.html>
More information about the Digitalmars-d-learn
mailing list