Fix memory leaks in trace projections and summary
[charm.git] / src / ck-core / charm-api.h
blobf76ef393ac217e7d30c5b3d648ffad9b994a30f0
1 /*
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.
5 */
6 #ifndef __CHARM_API_H
7 #define __CHARM_API_H
9 #include "conv-config.h" /* for CMK_FORTRAN symbols */
11 #ifdef __cplusplus
12 # define CLINKAGE extern "C"
13 #else
14 # define CLINKAGE /*empty*/
15 #endif
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*/
34 #else
35 /* # error "Did not set fortran name mangling scheme" */
36 # define FTN_NAME(caps,nocaps) NONMANGLED_##nocaps
37 #endif
40 /**
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) \
52 FDECL void \
53 FTN_NAME(CAPITALNAME,lowername) routine_args { \
54 Cname c_args;\
57 /**
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) \
61 FDECL returnType \
62 FTN_NAME(CAPITALNAME,lowername) routine_args { \
63 return Cname c_args;\
67 #endif /*Def(thisHeader) */