How to interface this C code to D?

How to convert C to D:

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

Is it correct?

alias const gchar* function( GModule *module ) GModuleCheckInit;
alias void function( GModule *module ) GModuleUnload;
+5
source share
1 answer

Line 1 should be

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

otherwise it constwill apply to all of this, making GModuleCheckInitit immutable.

Line 2 is correct.

+4
source

All Articles