mpi.h:使用一种W / O定义呢? [英] mpi.h: Using a type w/o defining it?

查看:323
本文介绍了mpi.h:使用一种W / O定义呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想的openmpi的mpi.h到D编程语言的重要组成部分翻译,所以我可以从D调用它(HTOD根本不工作)。我不能换我的头围绕以下code位:

I'm trying 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;

问题是, ompi_communicator_t 在mpi.h和mpi.h从未定义不包括除STDDEF.H任何其他文件,这显然不包含的定义。 (注释说,它包含了 ptrdiff_t的)。这是唯一的四行mpi.h包含字符串 ompi_communicator_t 。哪里是这样定义的结构是从哪里来的?是否有任何技巧我应该知道在哪里类型可以凭空出现的? (还有其他一些结构就是这样,但这是第一次,我偶然发现。)

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.)

推荐答案

这是一个指向结构,它的内部是不是外面的openmpi可见。使用任何类型的可容纳一个指针,例如(C语言)无效*

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*.

这篇关于mpi.h:使用一种W / O定义呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆