2004-06-09 19:09:16 +00:00
|
|
|
<?php
|
2004-05-21 20:06:34 +00:00
|
|
|
require_once("docutil.php");
|
2004-06-16 09:43:15 +00:00
|
|
|
page_head("FORTRAN applications");?>
|
|
|
|
|
2004-05-21 20:06:34 +00:00
|
|
|
<h2>How to use BOINC with FORTRAN and Visual Developer Studio</h2>
|
|
|
|
|
2004-06-16 09:44:31 +00:00
|
|
|
<p><font color=red>2004-06-16 note: this page is outdated; will update
|
2004-06-16 09:44:06 +00:00
|
|
|
(functions are now declared <code>extern"C"</code> so
|
2004-06-16 09:44:31 +00:00
|
|
|
no C++ mangling is done; there is a boinc_api_fortran.C wrapper) -- quarl@ssl
|
2004-06-16 09:44:06 +00:00
|
|
|
</font></p>
|
2004-06-16 09:43:15 +00:00
|
|
|
|
2004-05-21 20:06:34 +00:00
|
|
|
<p>
|
|
|
|
Note: a working example similar to the following
|
|
|
|
(based on outdated BOINC code) is
|
|
|
|
<a href=TestLibs.zip>here</a>; see also its <a href=taufer.txt>README</a>.
|
|
|
|
<p>
|
|
|
|
Start by creating a new FORTRAN project.
|
|
|
|
Add all the FORTRAN specific files,
|
|
|
|
then add all the files needed for the BOINC library (e.g. boinc_api.C).
|
|
|
|
Make sure that BOINC and the FORTRAN files are compiled
|
|
|
|
using the same type of standard libraries.
|
|
|
|
i.e. if the BOINC is compiled with the debug multithreaded DLL libraries,
|
|
|
|
make sure the FORTRAN files are compiled with the DLL setting.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
For every BOINC function you want to call from fortran you must add an
|
|
|
|
interface and subroutine:
|
|
|
|
<pre>
|
|
|
|
INTERFACE
|
2004-06-16 09:43:15 +00:00
|
|
|
SUBROUTINE boinc_finish(status)
|
2004-05-21 20:06:34 +00:00
|
|
|
END SUBROUTINE boinc_finish
|
|
|
|
END INTERFACE
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Remember to declare the type of arguments.
|
|
|
|
INTEGER status
|
|
|
|
|
|
|
|
<p>
|
|
|
|
You must then tell the compiler that the function
|
|
|
|
you are interfacing is a C routine.
|
|
|
|
You do this by adding the statement:
|
|
|
|
<pre>
|
|
|
|
!DEC$ ATTRIBUTES C :: boinc_finish
|
|
|
|
</pre>
|
|
|
|
Because BOINC is compiled as C++ files
|
2004-06-16 09:43:15 +00:00
|
|
|
the FORTRAN compiler will not be able to find
|
2004-05-21 20:06:34 +00:00
|
|
|
the standard function name in the object file,
|
|
|
|
you therefore have to add an alias for
|
|
|
|
the function giving the real function name:
|
|
|
|
<pre>
|
|
|
|
!DEC$ ATTRIBUTES ALIAS : '?boinc_finish@@YAHH@Z' :: boinc__finish
|
|
|
|
</pre>
|
|
|
|
<p>
|
|
|
|
This function name can be found in the object file.
|
|
|
|
Go to your compile directory and run dumpbin.
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
c:\fortranproject\Release>dumpbin /symbols boinc_api.obj
|
|
|
|
</pre>
|
|
|
|
|
|
|
|
this will give you a list of symbols, where you can find the real functionname.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
The interface will end up looking like this:
|
|
|
|
|
|
|
|
<pre>
|
|
|
|
INTERFACE
|
|
|
|
SUBROUTINE boinc_finish(status)
|
|
|
|
!DEC$ ATTRIBUTES C :: boinc_finish
|
|
|
|
!DEC$ ATTRIBUTES ALIAS : '?boinc_finish@@YAHH@Z' :: boinc__finish
|
2004-06-16 09:43:15 +00:00
|
|
|
INTEGER status
|
2004-05-21 20:06:34 +00:00
|
|
|
END SUBROUTINE boinc_finish
|
|
|
|
END INTERFACE
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
You can now call the BOINC function in FORTRAN.
|
|
|
|
<pre>
|
|
|
|
call boinc_finish(0)
|
|
|
|
</pre>
|
2004-06-16 09:43:15 +00:00
|
|
|
|
|
|
|
<?php
|
2004-05-21 20:06:34 +00:00
|
|
|
page_tail();
|
|
|
|
|
|
|
|
?>
|