extern(C) function literals for stubs

Marco Leise Marco.Leise at gmx.de
Wed Jan 22 10:05:08 PST 2014


Am Wed, 22 Jan 2014 17:52:03 +0000
schrieb "bearophile" <bearophileHUGS at lycos.com>:

> Marco Leise:
> 
> > Can I define them somehow? The use case is defining extern C
> > functions that contain code to load the real thing from a
> > library.
> >
> >   nothrow extern(C) void function(int) someFunc = ???
> 
> Perhaps you want:
> 
> extern(C) nothrow void someFunc(int someArg);
> 
> Bye,
> bearophile

Thanks, but I want it to be a function pointer so I can swap
it from within the function literal in the fashion of 

  nothrow extern(C) void function(int) someFunc = (int arg) {
      someFunc = GetProcAddress("someFunc");
      someFunc(arg);
  }

-- 
Marco



More information about the Digitalmars-d-learn mailing list