diff --git a/ompi/mpiext/example/c/progress.c b/ompi/mpiext/example/c/progress.c index 4287fca551..6d43185ae0 100644 --- a/ompi/mpiext/example/c/progress.c +++ b/ompi/mpiext/example/c/progress.c @@ -12,10 +12,37 @@ #include #include "ompi/mpi/c/bindings.h" +#include "ompi/mpiext/mpiext.h" #include "ompi/mpiext/example/mpiext_example_c.h" static const char FUNC_NAME[] = "OMPI_Progress"; +/* + * The init/fini functions and the component struct are not required, + * but optional. If an extension would like to have init/fini, in + * addition to providing the hooks below, adding the line in + * configure.m4 (documented in example's configure.m4) is also + * required. +*/ +static int +example_init(void) +{ + printf("example mpiext init\n"); + return OMPI_SUCCESS; +} + +static int +example_fini(void) +{ + printf("example mpiext fini\n"); + return OMPI_SUCCESS; +} + +ompi_mpiext_component_t ompi_mpiext_example = { + example_init, + example_fini +}; + int OMPI_Progress(char * stmt) { diff --git a/ompi/mpiext/example/configure.m4 b/ompi/mpiext/example/configure.m4 index 7f3ca4dba2..f1127031fc 100644 --- a/ompi/mpiext/example/configure.m4 +++ b/ompi/mpiext/example/configure.m4 @@ -15,3 +15,6 @@ AC_DEFUN([OMPI_MPIEXT_example_CONFIG],[ AC_CONFIG_FILES([ompi/mpiext/example/Makefile]) $1 ]) + +# only need to set this if the component needs init/finalize hooks +AC_DEFUN([OMPI_MPIEXT_example_NEED_INIT], [1]) diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 3a690d9e46..3a61f0463f 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -928,7 +928,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) the user's code. Setup the connections between procs and warm them up with simple sends, if requested */ - if (OMPI_SUCCESS != ompi_mpiext_init()) { + if (OMPI_SUCCESS != (ret = ompi_mpiext_init())) { error = "ompi_mpiext_init"; goto error; }