LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-20-2014, 01:03 PM   #1
AlexBB
Member
 
Registered: Mar 2014
Posts: 435

Rep: Reputation: Disabled
Need an explanation for gfortran interface code.


Hi there,

I had this code. The original code, however, did not have that interface part that follows the comment: ! THIS IS THE RIGHT WAY.

Code:
program main
  integer*4 :: N, counter
  real (kind = 8), dimension(:), allocatable :: work
! THIS IS THE RIGHT WAY
      interface
         subroutine test00_1 ( N, work )
           real*8, dimension(:) :: work
         end subroutine test00_1
      end interface
  open (unit=1,file="triangleWindow.dat",status = "old")
  N = 2310  
  allocate (work(1:N))
  call triangularWindow ( N, work )
10 format (E10.5)
  counter = 0
  do while (counter .le. N )
    counter = counter + 1
    write (1,10) work (counter)
  enddo
  close (unit=1)
  call test00_1 ( N, work )
  deallocate(work)
end program main
Without the Interface I was getting this compilation error:

Quote:
Error: Dummy argument 'work' of procedure 'test00_1' at (1) has an attribute that requires an explicit interface for this procedure
Of, course I don't understand what it all means. So, I did some googling and found this webpage which turned out to be very useful.

The error disappeared. Fine, but I still do not understand why it worked. Any help will be appreciated. Thanks, A.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
explanation of a code uma.g Linux - Newbie 2 02-03-2013 11:23 AM
Can't compile f77 code using gfortran or g77 GradientDrift Programming 2 11-18-2009 11:18 PM
awk code explanation pete1234 Programming 2 10-14-2006 08:05 PM
Code explanation ... ? dbee Linux - Software 1 12-17-2005 02:06 AM
fat fs code explanation ramya272 Programming 0 03-06-2004 10:55 AM


All times are GMT -5. The time now is 04:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration