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;
1
  • if you are interfacing to C functions you need to use extern(C) Nov 5, 2011 at 14:57

1 Answer 1

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.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.