Cryptic C function pointer for conversion

data pulverizer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Dec 17 07:30:36 PST 2016


On Saturday, 17 December 2016 at 14:06:07 UTC, ketmar wrote:
> On Saturday, 17 December 2016 at 13:39:27 UTC, data pulverizer 
> wrote:
>
> that is what it means, in D:
>
> //void (*(*xDlSym)(sqlite3_vfs*,void*, const char 
> *zSymbol))(void);
>
> struct sqlite3_vfs {}
>
> extern(C) {
> alias RetRes = void function ();
> alias DeclType = RetRes function (sqlite3_vfs *a,void *b, const 
> char *zSymbol);
>
> DeclType xDlSym;
>
> void zoo (void) {}
> auto goo (sqlite3_vfs *a,void *b, const char *zSymbol) { return 
> &zoo; }
> }
>
> void main () {
>   xDlSym = &goo;
> }
>
>
> at least that is what i managed to decode, fed to C(++) 
> compiler and translate to D.

p.s. I confirmed your interpretation on stackoverflow:

http://stackoverflow.com/questions/8722817/syntax-for-a-pointer-to-a-function-returning-a-function-pointer-in-c



More information about the Digitalmars-d-learn mailing list