【发布时间】:2011-08-04 17:17:19
【问题描述】:
我正在尝试将 OpenMPI 的 mpi.h 的重要部分翻译成 D 编程语言,以便我可以从 D 中调用它。(HTOD 根本不起作用。)我无法理解以下内容代码:
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。这个结构的定义来自哪里?有什么我应该注意的技巧吗?类型可以凭空出现? (还有其他几个类似的结构,但这是我偶然发现的第一个。)
【问题讨论】:
-
看起来像典型的不透明类型。你应该可以安全地用任何东西替换它,因为图书馆只关心地址。
-
@dsimcha:干得好!你会分享你的源代码以及你是如何编译示例程序的吗?谢谢!
标签: c header parallel-processing d mpi