Thursday, September 20, 2012

Compiling map65 for LInux, Ubuntu 12.04

Joe says...

First, compile the library libm65.a

$ cd libm65
$ make 


Which results in an error on my Ubuntu 12.04 machine...

m65a.F90:45.9:

  p_m65=>address_m65()
         1
Error: The pointer object 'address_m65' at (1) must have an explicit function interface or be declared as array


Ok...I've been stumped at this point before.  At the top of the m65a.F90 file, there's hint.

! NB: this interface block is required by g95, but must be omitted
!     for gfortran.  (????)

#ifndef UNIX
  interface
     function address_m65()
     end function address_m65
  end interface
#endif


Switching the state of the #ifndef produces a different result...
 
gfortran -c -fno-second-underscore -DUNIX m65a.F90
m65a.F90:45.9:

  p_m65=>address_m65()
         1
Error: Target expression in pointer assignment at (1) must deliver a pointer result


This site had a useful definition of pointers and functions returning pointers
     http://w3.pppl.gov/~hammett/comp/f90tut/f90.tut6.html

Well, after some fooling around, it complies.  First, define the return parameters for address_m65 with the interface block function definition.  Then remove the other reference defining address_m65  as a pointer.  Lastly, define the p_m65 points as an array.

===================================================================
--- m65a.F90    (revision 2591)
+++ m65a.F90    (working copy)
@@ -3,16 +3,17 @@
 ! NB: this interface block is required by g95, but must be omitted
 !     for gfortran.  (????)

-#ifndef UNIX
+#ifdef UNIX
   interface
      function address_m65()
+     integer*1, pointer :: address_m65(:)
      end function address_m65
   end interface
 #endif
  
   integer*1 attach_m65,lock_m65,unlock_m65
   integer size_m65
-  integer*1, pointer :: address_m65,p_m65
+  integer*1, pointer :: p_m65(:)
   character*80 cwd
   logical fileExists

   common/tracer/limtrace,lu


1 comment:

  1. How about some updates? How is the amp? How is the controller working out?

    ReplyDelete