Re: NAG ware linking problem
- From: "CSUIDL PROGRAMMEr" <syedamjad_a@xxxxxxxxx>
- Date: 11 Sep 2006 17:50:05 -0700
I do have v5.1
Ok , i reproduce my modified main .f
PROGRAM main
USE iso_c binding
IMPLICIT NONE
!.:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:. .:.
..:.
PRINT *,' hello from fortran '
INTERFACE
SUBROUTINE antfarm() bind (c)
END SUBROUTINE
end INTERFACE
! CALL antfarm ()
END PROGRAM main
!=======================================================================
! END
!========
This is my C/C++ code
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//extern "C" void antfarm ();
extern void antfarm();
/**********************************************************************/
void antfarm ()
{
printf ("\n hello from c. \n");
}
~
and this is error
make
/usr/bin/g++ -c ../source/utilities_system.c
/usr/bin/cpp-4.0 -P -traditional ../source/main.F > main.f95
/usr/local/nag/bin/mpif77 -c main.f95
Fatal Error: main.f95, line 4: Cannot find module ISO_C
detected at ISO_C@BINDING
Richard E Maine wrote:
CSUIDL PROGRAMMEr <syedamjad_a@xxxxxxxxx> wrote:
so you mean to add this code in main.f
I tried doing that
but it does not work
I'm afraid that "does not work" is insufficient data for me to comment
usefully on.
I don't have the V51 compiler on my Mac yet, so I can't test this there.
I tried it on our Linux server and it worked fine, except for 2 things.
1. It does give a warning message for the use of BIND, since that f2003
feature is an extension to f95. I suppose you might be mistaking that
warning message as an error; it isn't.
2. I had noticed before, but failed to comment on the fact that your
alleged "C code" is not in fact C, but is instead C++. Yes, there is a
difference. Anyway, the C compilers I tried didn't like it and I
wouldn't have expected them to. I used a C++ compiler, which compiled it
ok, but then I got some linking problem about a missing g++ piece. I
obviously don't know something about how to link C++ and f90 code, and I
didn't spend much (well, any) time looking into it. Instead, I fixed it
so that the code was valid C (namely, I deleted the "C" from the extern
statement). It then compiled, linked, and ran as expected.
I can't tell from your "does not work" description whether:
1. You don't have V 5.1 of the compiler. I did mention that 5.1 is
required; if you don't have 5.1, there isn't any point in trying that.
2. You have V5.1, but it didn't compile for some reason that I can't
diagnose without data.
3. It compiled, but you mistook the warning message for an error.
4. Something else, which I can't diagnose without data.
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- Follow-Ups:
- Re: NAG ware linking problem
- From: Jan Vorbrüggen
- Re: NAG ware linking problem
- From: Richard Maine
- Re: NAG ware linking problem
- References:
- NAG ware linking problem
- From: CSUIDL PROGRAMMEr
- Re: NAG ware linking problem
- From: Richard E Maine
- Re: NAG ware linking problem
- From: CSUIDL PROGRAMMEr
- Re: NAG ware linking problem
- From: Richard E Maine
- NAG ware linking problem
- Prev by Date: Re: Library to work with JPEG
- Next by Date: Re: NAG ware linking problem
- Previous by thread: Re: NAG ware linking problem
- Next by thread: Re: NAG ware linking problem
- Index(es):
Relevant Pages
|