D-Programming-Deimos/ZeroMQ — pull request #15 by kyllingstad (2014-11-16 12:05:32+00:00)
Title: Updated to ZMQ 4.0

I've split the changes since 3.2.4 between several commits, one for each patch release in the 4.0 series up to 4.0.5, which is the latest stable release. In addition to updating the C headers and D bindings, I've added the AUTHORS and COPYING.LESSER files from the official ZeroMQ repository. The former is referenced in a comment in the source, so it might be confusing if it's not there, while the latter contains the LGPL and is therefore required to be present.

I have two questions. The header file `C/zmq_utils.h` contains a typedef to a function type (i.e., not a function *pointer* type):

typedef void (zmq_thread_fn) (void*);

I don't know of a way to express this directly in D, so I faked it like this:

alias typeof(*(void function(void*)).init) zmq_thread_fn;

In both C and D, the type can now be used as follows:

void *zmq_threadstart (zmq_thread_fn* func, void* arg);

The questions are:

1. Is the fact that this works an "official" feature of D, or just a quirk of DMD? (@WalterBright?)
2. Is there a more concise way to express function types in D?