On Wed, 15 Sep 2010 17:05:24 -0400, Yao G. <yao.go...@spam.gmail.com> wrote:

Hello gentlemen:

I'm trying to translate the newest SQLite C header to D, and I stumbled unto this gem:
void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void);

What's that? A function pointer that takes another function pointer as its name? I'm stuck at this and I don't know how to convert it to a D function pointer. Certainly, the inner pointer is easy:
void (* function(sqlite3_vfs*,void*, const(char) *zSymbol) xDlSym)();

But what about the outer one? I am missing something?

Thanks in advance.

D supports C-style function pointers.  See here:

typedef char sqlite3_vfs;

// note you can't use void as a parameter type in D
void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(/*void*/);
pragma(msg, typeof(xDlSym).stringof);

outputs:

void function() function(sqlite3_vfs*, void*, const const(char*) zSymbol)

so I think it's a function pointer that takes those parameters and returns a function pointer that takes no parameters and returns nothing.

-Steve

Reply via email to