mpi.h: Using a type w/o defining it?
I'm 开发者_StackOverflowtrying to translate the important parts of OpenMPI's mpi.h to the D programming language so I can call it from D. (HTOD didn't work at all.) I can't wrap my head around the following bits of code:
typedef struct ompi_communicator_t *MPI_Comm;
OMPI_DECLSPEC extern struct ompi_communicator_t ompi_mpi_comm_world;
OMPI_DECLSPEC extern struct ompi_communicator_t ompi_mpi_comm_self;
OMPI_DECLSPEC extern struct ompi_communicator_t ompi_mpi_comm_null;
The problem is that ompi_communicator_t
is never defined in mpi.h and mpi.h doesn't include any other file besides stddef.h, which clearly doesn't contain a definition. (The comment says it's included for ptrdiff_t
.) These are the only four lines in mpi.h that contain the string ompi_communicator_t
. Where is the definition of this struct coming from? Are there any tricks I should be aware of where types can appear out of thin air? (There are several other structs like this, but this is the first one I stumbled upon.)
This is a pointer to the struct, which internals are not visible outside the OpenMPI. Use any type which can hold a pointer, e.g. (in C) void*
.
精彩评论