1 /*
2 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2007-2012 Cisco Systems, Inc. All rights reserved.
13 * $COPYRIGHT$
14 *
15 * Additional copyrights may follow
16 *
17 * $HEADER$
18 */
19
20 /*
21 * This file defines the 5 back-end functions for Fortran's version of
22 * MPI_CONVERSION_FN_NULL. These functions will never be invoked, but
23 * are rather used as sentinel values by the Fortran
24 * MPI_REGISTER_DATAREP function. However, given the way Fortran
25 * sentinel values have to be handled (4 versions for the 4 different
26 * symbol conventions), and given that these symbols must be the same
27 * size as a function pointer (because the user could pass either
28 * MPI_REGISTER_DATAREP *or* a real function), it just seemed either
29 * to use the normal mechanisms we already have in place for Fortran
30 * bindings and sentinel values -- even though it's a bit overkill
31 * (e.g., the back-end mpi_conversion_fn_null_f function will never be
32 * used for anything).
33 *
34 * See also the comments in ompi/mpi/f77/datarep.h.
35 */
36
37 #include "ompi_config.h"
38
39 #include "ompi/mpi/fortran/base/datarep.h"
40 #include "ompi/mpi/fortran/base/fint_2_int.h"
41 #include "ompi/mpi/fortran/mpif-h/bindings.h"
42
43 #if OPAL_HAVE_WEAK_SYMBOLS
44 #pragma weak MPI_CONVERSION_FN_NULL = mpi_conversion_fn_null_f
45 #pragma weak mpi_conversion_fn_null = mpi_conversion_fn_null_f
46 #pragma weak mpi_conversion_fn_null_ = mpi_conversion_fn_null_f
47 #pragma weak mpi_conversion_fn_null__ = mpi_conversion_fn_null_f
48 #endif
49
50 #if ! OPAL_HAVE_WEAK_SYMBOLS && ! OMPI_PROFILE_LAYER
51 OMPI_GENERATE_F77_BINDINGS(MPI_CONVERSION_FN_NULL,
52 mpi_conversion_fn_null,
53 mpi_conversion_fn_null_,
54 mpi_conversion_fn_null__,
55 mpi_conversion_fn_null_f,
56 (char *userbuf, MPI_Fint *datatype, MPI_Fint *count, char *filebuf, MPI_Offset *position, MPI_Aint *extra_state, MPI_Fint *ierr),
57 (userbuf, datatype, count, filebuf, position, extra_state, ierr) )
58 #endif
59
60
61 void mpi_conversion_fn_null_f(char *userbuf, MPI_Fint *datatype,
62 MPI_Fint *count, char *filebuf,
63 MPI_Offset *position,
64 MPI_Aint *extra_state,
65 MPI_Fint *ierr)
66 {
67 /* Per MPI-2:9.5.3, this function will never be called; it's only
68 used as a sentinel value for comparison. But we need to put
69 something here so that the compiler/linker doesn't optimize it
70 out. */
71 *ierr = OMPI_INT_2_FINT(MPI_SUCCESS);
72 }