[Top] [All Lists]

Re: Cannot call a C module from Fortran

Subject: Re: Cannot call a C module from Fortran
From: "Cottonwood"
Date: 24 May 2006 01:02:42 -0700
Newsgroups:, comp.lang.fortran
Cottonwood wrote:
> I want to call a C module from a Fortran program. Whatever I tried -
> the linker could not find the C module
> The result was always the same. With the Fortran subroutine linking
> works, with one of the C modules I get the message
> qqmodlib.a(qqprint.o):qqprint.for:(.text+0x42): undefined reference to
> `qqcprint'
> What am I doing wrong?

I'm on Windows XP and using GNU G95 (2003 standard) with the option
-fno-underscoring and GNU C++

Because I have no problem to call Fortran from C this can't ba a
conflict with the names. Meanwhile I found out that the problem is not
related to Fortran. Now I have this C main:

extern "C" void qqcprint();
int main()
return 0;

and my C routine is quite the same:

extern void qqcprint()

The module is in the project al well as in the linked modlib qqmodlib.a
But the message I get is always

[Linker error] undefined reference to `qqcprint'. The 'nm' program was
not in the delivery.

<Prev in Thread] Current Thread [Next in Thread>