5

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;
Deduplicator
  • 44,692
  • 7
  • 66
  • 118
bioinfornatics
  • 1,749
  • 3
  • 17
  • 36

1 Answers1

4

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.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005