Changes between Version 10 and Version 11 of FortranApps


Ignore:
Timestamp:
Oct 31, 2007, 8:09:39 PM (17 years ago)
Author:
chojin
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FortranApps

    v10 v11  
    4040  SUBROUTINE boinc_finish(status)
    4141    !DEC$ ATTRIBUTES C :: boinc_finish
    42     !DEC$ ATTRIBUTES ALIAS : '?boinc_finish@@YAHH@Z' :: boinc__finish
    4342    INTEGER status
    4443  END SUBROUTINE boinc_finish
     
    9291Link with: `libboinc.lib`, `libboincapi.lib`, own graphics lib, `gdi32.lib` `user32.lib` `opengl32.lib` `glu32.lib` `advapi32.lib` `delayimp.lib` `freetype.lib` `glut32.lib` (you may need `/link /nodefaultlib:libc.lib`).
    9392
     93== Advice from Scott Kruger ==
     94
     95Under Linux with ifort:
     96
     97boinc_api_fortran.C seems work just fine, except that a few modifications were needed to make it work for us.
     98
     99 1. Need to include "str_util.h"
     100 2. Comment out '#include "boinc_zip.h"'
     101 3. Comment out these functions: boinc_write_init_data_file, boinc_zip
     102 4. Change the function boincrf_ to the following:
     103
     104{{{
     105void boincrf_(const char* s, char* t, int * s_len, int * t_len) {
     106    STRING_FROM_FORTRAN sff(s, *s_len);
     107    sff.strip_whitespace();
     108    boinc_resolve_filename(sff.c_str(), t, *t_len);
     109    string_to_fortran(t, *t_len);
     110}
     111}}}
     112
     113Compile and include boinc_api_fortran.o when you link everything together.
     114
     115Under Windows with ifort:
     116
     117We were unable to get the either the INTERFACE or boinc_api_fortran.C approaches to work properly, so we settled on a combination of the two. boincrf_ is still useful because you are working with Fortran strings, so you'll still want to use boinc_api_fortran.C (we compiled it with libboincapi.lib). You will still need to change a few things around:
     118 1. Visual Studio 2005 didn't like strlcpy somewhere in the BOINC API, so that had to be changed to strncpy (you might not have to do this if strlcpy works for you).
     119 2. Make all the aforementioned changes to boinc_api_fortran.C except step 4
     120
     121Also, you'll want to explicitly include Fortran INTERFACEs to your code. boincrf_ is especially tricky:
     122
     123{{{
     124INTERFACE
     125  SUBROUTINE boincrf_(s, t, s_len, t_len)
     126    !DEC$ ATTRIBUTES C :: boincrf_
     127    CHARACTER* (*) s
     128    !DEC$ ATTRIBUTES REFERENCE :: s
     129    CHARACTER* (*) t
     130    !DEC$ ATTRIBUTES REFERENCE :: t
     131    INTEGER s_len
     132    INTEGER t_len
     133  END SUBROUTINE boincrf_
     134END INTERFACE
     135}}}
     136
     137You'll have to include an interface for every BOINC function you want to call, but it isn't all that difficult for the others.
     138
    94139== Example from David Braun ==
    95140