<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>http://202.127.29.3/~shen/wiki/index.php?action=history&amp;feed=atom&amp;title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8</id>
	<title>Fortran程序调用 - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="http://202.127.29.3/~shen/wiki/index.php?action=history&amp;feed=atom&amp;title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8"/>
	<link rel="alternate" type="text/html" href="http://202.127.29.3/~shen/wiki/index.php?title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8&amp;action=history"/>
	<updated>2026-04-09T03:50:59Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.38.1</generator>
	<entry>
		<id>http://202.127.29.3/~shen/wiki/index.php?title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8&amp;diff=71&amp;oldid=prev</id>
		<title>2012年4月7日 (六) 11:20 159.226.169.140</title>
		<link rel="alternate" type="text/html" href="http://202.127.29.3/~shen/wiki/index.php?title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8&amp;diff=71&amp;oldid=prev"/>
		<updated>2012-04-07T11:20:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2012年4月7日 (六) 11:20的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第27行：&lt;/td&gt;
  &lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第27行：&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; END&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; END&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;编译生成动态链接库文件&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;编译生成&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[&lt;/ins&gt;动态链接库文件&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; ifort -shared -fpic  SUM_ARRAY.f SUM_ARRAY1.f -o example1.so&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; ifort -shared -fpic  SUM_ARRAY.f SUM_ARRAY1.f -o example1.so&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; -shared   produce a shared object&lt;/div&gt;&lt;/td&gt;
  &lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;
  &lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; -shared   produce a shared object&lt;/div&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>159.226.169.140</name></author>
	</entry>
	<entry>
		<id>http://202.127.29.3/~shen/wiki/index.php?title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8&amp;diff=70&amp;oldid=prev</id>
		<title>159.226.169.140：​以“先要给要调用的Fortran程序写一个接口，例  接口程序：   SUBROUTINE SUM_ARRAY(argc, argv)  !Called by IDL  INTEGER*4 argc, argv(*)           !Argc ...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="http://202.127.29.3/~shen/wiki/index.php?title=Fortran%E7%A8%8B%E5%BA%8F%E8%B0%83%E7%94%A8&amp;diff=70&amp;oldid=prev"/>
		<updated>2012-04-07T11:19:12Z</updated>

		<summary type="html">&lt;p&gt;以“先要给要调用的Fortran程序写一个接口，例  接口程序：   SUBROUTINE SUM_ARRAY(argc, argv)  !Called by IDL  INTEGER*4 argc, argv(*)           !Argc ...”为内容创建页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;先要给要调用的Fortran程序写一个接口，例&lt;br /&gt;
&lt;br /&gt;
接口程序：&lt;br /&gt;
&lt;br /&gt;
 SUBROUTINE SUM_ARRAY(argc, argv)  !Called by IDL&lt;br /&gt;
 INTEGER*4 argc, argv(*)           !Argc and Argv are integers&lt;br /&gt;
 j = LOC(argc)         !Obtains the number of arguments (argc)&lt;br /&gt;
                      !Because argc is passed by VALUE.&lt;br /&gt;
 ;&lt;br /&gt;
 ! Call subroutine SUM_ARRAY1, converting the IDL parameters&lt;br /&gt;
 ! to standard Fortran, passed by reference arguments:&lt;br /&gt;
 CALL SUM_ARRAY1(%VAL(argv(1)), %VAL(argv(2)), %VAL(argv(3)))&lt;br /&gt;
 RETURN&lt;br /&gt;
 END&lt;br /&gt;
&lt;br /&gt;
调用程序：&lt;br /&gt;
&lt;br /&gt;
 ! This subroutine is called by SUM_ARRAY and has no  IDL specific code.&lt;br /&gt;
 SUBROUTINE SUM_ARRAY1(array, n, sum)&lt;br /&gt;
 INTEGER*4 n&lt;br /&gt;
 REAL*4 array(n), sum&lt;br /&gt;
 sum=0.0&lt;br /&gt;
 DO i=1,n&lt;br /&gt;
 sum = sum + array(i)&lt;br /&gt;
 ENDDO&lt;br /&gt;
 RETURN&lt;br /&gt;
 END&lt;br /&gt;
&lt;br /&gt;
编译生成动态链接库文件&lt;br /&gt;
 ifort -shared -fpic  SUM_ARRAY.f SUM_ARRAY1.f -o example1.so&lt;br /&gt;
 -shared   produce a shared object&lt;br /&gt;
 -fpic  generate position independent code (-fno-pic/-fno-PIC is DEFAULT)&lt;br /&gt;
&lt;br /&gt;
然后在IDL中的调用方法如下&lt;br /&gt;
 X = FINDGEN(10) ; Make an array.&lt;br /&gt;
 sum = 0.0&lt;br /&gt;
 S = CALL_EXTERNAL(&amp;#039;example1.so&amp;#039;, &amp;#039;sum_array_&amp;#039;, X, N_ELEMENTS(X), sum)&lt;/div&gt;</summary>
		<author><name>159.226.169.140</name></author>
	</entry>
</feed>