Re: NAG ware linking problem



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

.



Relevant Pages

  • Compiler Warning C4373 about virtual methods
    ... The following code will result in C4373 warning message. ... What means "bind"? ... either the base or derived class. ... Versions of the compiler prior to Visual C++ 2008 bind the function to the ...
    (microsoft.public.vc.language)
  • Re: NAG ware linking problem
    ... Adding the following interface block ought to do the trick. ... subroutine antfarm() bind ... If you don't have version 5.1 of the compiler, ... Basically, all Fortran procedure ...
    (comp.lang.fortran)
  • Re: NAG ware linking problem
    ... Adding the following interface block ought to do the trick. ... subroutine antfarm() bind ... If you don't have version 5.1 of the compiler, ... Basically, all Fortran procedure ...
    (comp.lang.fortran)
  • Re: Method ***** not found. Warning displayed in Form1.cs [Design] pane
    ... Warning message: Method 'System.Windows.Forms.Form.DisplayMessage' not ... The file where you're trying to add the call site to your new method is a special file: in addition to being compiled by the C# compiler to create your Form sub-class, it is parsed by the Visual Studio Designer as part of showing you the graphical representation of the object and allowing you to edit it. ... If the Designer comes across something it doesn't recognize, it has no way to know what to do with it. ... It's possible that you should simply call the method from your own construction, after the call to InitializeComponent, or that you should override the OnFormLoador OnShownmethods and call the method in the override. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Databinding Wishlist
    ... bind to say an specific collection element. ... > COMPILER CHECKED BINDING ... > To be able to bind a properties in a way that is checked by the compiler> rather than waiting for a possible runtime error due to a typo. ...
    (microsoft.public.dotnet.framework.windowsforms.databinding)