Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Adam C Powell IV <hazelsct@mit.edu>
To: Debian Alpha <debian-alpha@lists.debian.org>, axp-list@redhat.com
Subject: Linking C main() to shlibs with Fortran sources using ccc/fort
Date: Tue, 16 Apr 2002 16:03:44 -0400	[thread overview]
Message-ID: <3CBC83A0.4010206@mit.edu> (raw)

Greetings,

I'd like to link some shlibs with some Fortran source to some C programs 
using the Compaq compilers to compile everything.  Trouble is, some of 
the Fortran objects need symbols like for_write..., which are provided 
by libfor.so, and that in turn needs this "MAIN__()" symbol, which is 
*only* provided by an fort-compiled object file with a Fortran PROGRAM 
statement, it's not in any of the libs which come with fort, nor in 
for_main.o.

I've noticed that if the libs are static, linking works just fine, but 
if I rebuild objects to shared libs using:

${LD} -shared -soname,$$LIBNAME.${SLSUFFIX} -o $$LIBNAME.${SLSUFFIX} *.o

then linking against the resulting shlibs fails with an undefined 
reference to MAIN__() in libfor.so.  Also, if I provide a C function like:

void MAIN__()
{
    printf ("hello world\n");
}

then it links fine, but hello world is never printed, so the function is 
never entered.  I'd really like to not have to provide this bit of code 
for this one arch/compiler combo...

Is there a way to do this?

Thanks,
-- 

-Adam P.

GPG fingerprint: D54D 1AEE B11C CE9B A02B  C5DD 526F 01E8 564E E4B6

Welcome to the best software in the world today cafe! 
<http://lyre.mit.edu/%7Epowell/The_Best_Stuff_In_The_World_Today_Cafe.ogg>






             reply	other threads:[~2002-04-16 20:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-16 20:03 Adam C Powell IV [this message]
2002-06-23  3:29 ` Linking C main() to shlibs with Fortran sources using ccc/fort Adam C Powell IV
2002-06-23  3:58   ` George France
2002-06-23  4:11     ` Adam C Powell IV
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox