2 Define symbols used to define entry points for API routines
3 for clients written in C or Fortran. Useful for building
4 libraries written in Charm for other languages.
9 #include "conv-config.h" /* for CMK_FORTRAN symbols */
12 # define CLINKAGE extern "C"
14 # define CLINKAGE /*empty*/
17 /** Used to define a "C" entry point*/
18 #undef CDECL /*<- used by Microsoft Visual C++*/
19 #define CDECL CLINKAGE
21 /** Used to define a Fortran-callable routine*/
22 #define FDECL CLINKAGE
24 /** Fortran name mangling:
26 #if CMK_FORTRAN_USES_ALLCAPS
27 # define FTN_NAME(caps,nocaps) caps /*Declare name in all caps*/
28 #elif CMK_FORTRAN_USES_TWOSCORE
29 # define FTN_NAME(caps,nocaps) nocaps##__ /*No caps, two underscores*/
30 #elif CMK_FORTRAN_USES_ONESCORE
31 # define FTN_NAME(caps,nocaps) nocaps##_ /*No caps, one underscore*/
32 #elif CMK_FORTRAN_USES_NOSCORE
33 # define FTN_NAME(caps,nocaps) nocaps /*No caps, no underscore*/
35 /* # error "Did not set fortran name mangling scheme" */
36 # define FTN_NAME(caps,nocaps) NONMANGLED_##nocaps
41 * Define a new Fortran-callable API routine, returning void,
42 * that does nothing but map its arguments onto some
43 * (presumably analogous) C routine.
45 * @param CAPITALNAME Fortran routine name to define, in all capital letters.
46 * @param Cname C routine to call, in normal case.
47 * @param lowername Fortran routine name in all lowercase.
48 * @param routine_args Fortran routine's arguments (e.g., "int *idx")
49 * @param c_args Arguments to pass to C routine (e.g., "*idx-1")
51 #define FORTRAN_AS_C(CAPITALNAME,Cname,lowername, routine_args,c_args) \
53 FTN_NAME(CAPITALNAME,lowername) routine_args { \
58 * Like FORTRAN_AS_C, but with a return type as the first parameter.
60 #define FORTRAN_AS_C_RETURN(returnType, CAPITALNAME,Cname,lowername, routine_args,c_args) \
62 FTN_NAME(CAPITALNAME,lowername) routine_args { \
67 #endif /*Def(thisHeader) */