| 93 | == Advice from Scott Kruger == |
| 94 | |
| 95 | Under Linux with ifort: |
| 96 | |
| 97 | boinc_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 | {{{ |
| 105 | void 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 | |
| 113 | Compile and include boinc_api_fortran.o when you link everything together. |
| 114 | |
| 115 | Under Windows with ifort: |
| 116 | |
| 117 | We 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 | |
| 121 | Also, you'll want to explicitly include Fortran INTERFACEs to your code. boincrf_ is especially tricky: |
| 122 | |
| 123 | {{{ |
| 124 | INTERFACE |
| 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_ |
| 134 | END INTERFACE |
| 135 | }}} |
| 136 | |
| 137 | You'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 | |