C Interface
The C interface is provided through a set of functions defined in the
cmsg.h
header file. These functions are implemented using the
C interoperability capabilities
in Fortram 2003/2008/2018, and are based around a pair of void *
typedefs — SpecGrid
and PhotGrid
— that store
pointers to corresponding Fortran specgrid_t
and
photgrid_t
objects.
API Specification
Compiling/Linking
Headers for the C interface are provided in the header file
$MSG_DIR/include/cmsg.h
, and executables should be linked
against $MSG_DIR/lib/libcmsg.so
(Linux) or
$MSG_DIR/lib/libcmsg.dylib
(MacOS). To simplify this process,
a script $MSG_DIR/scripts/cmsg_link
is provided that writes
the appropriate linker commands to standard output. This script can be
used to compile/link a program with gcc as follows:
gcc -I $MSG_DIR/include -o myprogram myprogram.c `$MSG_DIR/scripts/cmsg_link`