tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
a case for MAIN__ tricks with f2c
Hi -
I might have found a case where the current libf2c defining
a C-style main() function which refers to the fortran MAIN__
fails. Seen this in HDF4:
There is a shared library which contains both C and Fortran
functions. For Fortran runtime support, it links against
the (shared) libf2c. But generally, it can be used from C
programs.
Now if a C program uses this library, it gets a link error
due to an undefined MAIN__. This wouldn't happen with a
static lib because the main.o object wouldn't be pulled
in, but with a shared lib everything sticks together.
For me, the appended patch helps. Some "#ifdef _GNUC_"
or so might be needed. gcc's gfortran puts the main()
finction in an extra object, but this would need changes
to the wrapper script.
best regards
Matthias
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
$NetBSD$
--- main.c.orig 2008-04-06 04:42:46.000000000 +0200
+++ main.c
@@ -49,7 +49,7 @@ extern int MAIN__();
#define Int /* int */
#else
extern void f_init(void), sig_die(const char*, int);
-extern int MAIN__(void);
+extern int MAIN__(void) __attribute__((weakref));
#define Int int
#endif
Home |
Main Index |
Thread Index |
Old Index