How to create C function pointers
Don Clugston
dac at nospam.com.au
Thu Sep 7 08:04:32 PDT 2006
Mildred wrote:
> Hi,
>
> So, I need to have C functions pointers but I don't know how to declare
> them correctly :
It's easiest to typedef them; the typedef picks up the extern(C).
> module test;
>
> extern(C){
> int c_function(int param){
> return param;
> }
> }
extern (C) {
typedef int function(int) CFuncPtr;
}
void main() {
CFuncPtr ptr = &c_function;
}
BTW, this type of question really belongs in the 'D.learn' newgroup.
More information about the Digitalmars-d
mailing list