Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How interface this C code to D?

Tags:

c

d

phobos

How should this C be convert to D :

typedef const gchar* (*GModuleCheckInit) (GModule *module);
typedef void (*GModuleUnload) (GModule *module);

Is this correct ?

alias const gchar* function( GModule *module ) GModuleCheckInit;
alias void function( GModule *module ) GModuleUnload;
like image 264
bioinfornatics Avatar asked Oct 09 '22 13:10

bioinfornatics


1 Answers

Line 1 should be

alias const(gchar)* function( GModule *module ) GModuleCheckInit;
//         ^     ^

otherwise the const will apply to the whole thing, making GModuleCheckInit not mutable.

Line 2 is correct.

like image 110
kennytm Avatar answered Oct 13 '22 10:10

kennytm