【发布时间】:2019-03-12 15:27:14
【问题描述】:
例如,我想在用 C 编写的程序中调用所有 MPI_Sends 之前编写一个字符串。为此,我想编写一个分析库。我在 mylib.c 中编写了这段代码
#include <stdio.h>
#include <mpi.h>
int MPI_Send(void *buf, int count, MPI_Datatype type, int to, int tag, MPI_Comm comm)
{
printf("Some string");
return PMPI_Send(buf, count, type, to, tag, comm);
}
如果我运行mpicc -fPIC mylib.c -o mylib.o,我会得到错误-error: conflicting types for ‘MPI_Send’
如何正确编写此代码以及如何编译并将其链接到我的 mpi 程序?
【问题讨论】:
标签: c shared-libraries mpi dynamic-linking