summaryrefslogtreecommitdiffstats
path: root/Modules/FortranCInterface/symbol.c.in
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-08-05 17:40:29 (GMT)
committerBrad King <brad.king@kitware.com>2009-08-05 17:40:29 (GMT)
commit80f0201b37576a4229ec9453a31d3be804abbcb4 (patch)
tree55229acdf15a513e9acaa6058178f6e76c36c61a /Modules/FortranCInterface/symbol.c.in
parent7b36fd637cf9fa3fdc70edec924a48a4ca76f5ac (diff)
downloadCMake-80f0201b37576a4229ec9453a31d3be804abbcb4.zip
CMake-80f0201b37576a4229ec9453a31d3be804abbcb4.tar.gz
CMake-80f0201b37576a4229ec9453a31d3be804abbcb4.tar.bz2
Rewrite FortranCInterface module
This is a new FortranCInterface.cmake module to replace the previous prototype. All module support files lie in a FortranCInterface directory next to it. This module uses a new approach to detect Fortran symbol mangling. We build a single test project which defines symbols in a Fortran library (one per object-file) and calls them from a Fortran executable. The executable links to a C library which defines symbols encoding all known manglings (one per object-file). The C library falls back to the Fortran library for symbols it cannot provide. Therefore the executable will always link, but prefers the C-implemented symbols when they match. These symbols store string literals of the form INFO:symbol[<name>] so we can parse them out of the executable. This module also provides a simpler interface. It always detects the mangling as soon as it is included. A single macro is provided to generate mangling macros and optionally pre-mangled symbols.
Diffstat (limited to 'Modules/FortranCInterface/symbol.c.in')
-rw-r--r--Modules/FortranCInterface/symbol.c.in4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/FortranCInterface/symbol.c.in b/Modules/FortranCInterface/symbol.c.in
new file mode 100644
index 0000000..369fa45
--- /dev/null
+++ b/Modules/FortranCInterface/symbol.c.in
@@ -0,0 +1,4 @@
+const char* @symbol@(void)
+{
+ return "INFO:symbol[@symbol@]";
+}