mirror of
https://github.com/reactos/CMake.git
synced 2024-12-02 00:26:18 +00:00
80f0201b37
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.
13 lines
168 B
C
13 lines
168 B
C
#include "foo.h"
|
|
extern F_test_mod_sub(void);
|
|
extern F_mysub(void);
|
|
int myc(void)
|
|
{
|
|
F_mysub();
|
|
F_my_sub();
|
|
#ifdef TEST_MOD
|
|
F_test_mod_sub();
|
|
#endif
|
|
return 0;
|
|
}
|