c - mpi.h : Using a type w/o defining it?

标签 c header parallel-processing d mpi

我正在尝试将 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。这个结构的定义来自哪里?有什么技巧我应该知道类型可以凭空出现吗? (还有其他几个类似的结构,但这是我偶然发现的第一个。)

最佳答案

这是一个指向结构的指针,其内部在 OpenMPI 之外是不可见的。使用任何可以容纳指针的类型,例如(在 C 中)void*

关于c - mpi.h : Using a type w/o defining it?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6945728/

相关文章:

iis - 为什么 IIS CORS 模块 'Access-Control-Allow-Origin' 似乎被缓存了?

linux - 什么核心在运行我的进程?

c - 如何在代码中使用白色

c++ - 头文件中的类声明和实现

PHP curl 头

c - MPI pi 计算中的节点计数无效

javascript - 使用 Javascript node.js 如何并行处理 For 循环?

c - 为什么我的第一个输入不显示?

c - 防止间接级别内的宏扩展

我可以在设置 CURLOPT_HTTPHEADER 后立即调用 curl_slist_free_all 吗?