<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: use-host assoiation in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975720#M24965</link>
    <description>In your case, func is not visible at all outside main.  Now if main were a module and func was a module procedure, optimizer could USE the module and call func.&lt;BR /&gt;&lt;BR /&gt;The other thing you could do is something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+0"&gt;
program main
call sub (func)
contains
integer function func (i)
func = i + 1
return
end function func
end
subroutine sub (func)
integer, external :: func
write (*,*) func(3)
return
end
&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In this case, you must make sure that the function is called with exactly the number of arguments it expects. (Your sample CALLed a function, which is a no-no.)&lt;BR /&gt;&lt;BR /&gt;The above is non-standard, but CVF supports it.&lt;BR /&gt;&lt;BR /&gt;I hope this helps.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
    <pubDate>Thu, 29 Nov 2001 07:10:18 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2001-11-29T07:10:18Z</dc:date>
    <item>
      <title>use-host assoiation</title>
      <link>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975719#M24964</link>
      <description>I need to run an optimization  algorithm but the fucntion which returns the value to optimize is use-host associated with the routine which calls the optimizer like this: &lt;BR /&gt; &lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+1"&gt;
main: 
get necessary data &amp;amp; parameters to evaluate function 
call optimzer 
CONTAINS 
function func 
calculate with data shared by use-host assoc from main 
end func 
end main 
 
subroutine optimizer 
... 
call func 
... 
end optimizer 
&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I know that I read in the doc that though not standard, CVF does support exporting the use-host routines externally, but the above scheme does not link saying that the func call in Optimizer is unresolved. &lt;BR /&gt; &lt;BR /&gt;Can this really be done? if so how? &lt;BR /&gt;moreover, Can the optimizer everbe put in a module and still call a func not inside it? &lt;BR /&gt; &lt;BR /&gt;Thanks, Tim</description>
      <pubDate>Thu, 29 Nov 2001 06:54:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975719#M24964</guid>
      <dc:creator>rahzan</dc:creator>
      <dc:date>2001-11-29T06:54:39Z</dc:date>
    </item>
    <item>
      <title>Re: use-host assoiation</title>
      <link>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975720#M24965</link>
      <description>In your case, func is not visible at all outside main.  Now if main were a module and func was a module procedure, optimizer could USE the module and call func.&lt;BR /&gt;&lt;BR /&gt;The other thing you could do is something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;FONT size="+0"&gt;
program main
call sub (func)
contains
integer function func (i)
func = i + 1
return
end function func
end
subroutine sub (func)
integer, external :: func
write (*,*) func(3)
return
end
&lt;/FONT&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;In this case, you must make sure that the function is called with exactly the number of arguments it expects. (Your sample CALLed a function, which is a no-no.)&lt;BR /&gt;&lt;BR /&gt;The above is non-standard, but CVF supports it.&lt;BR /&gt;&lt;BR /&gt;I hope this helps.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Thu, 29 Nov 2001 07:10:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975720#M24965</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2001-11-29T07:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: use-host assoiation</title>
      <link>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975721#M24966</link>
      <description>Thanks Steve, &lt;BR /&gt;This was a dum q to start, of course the second metod you show should be obvious, as I realized after posting the msg. &lt;BR /&gt;Sorry! &lt;BR /&gt;Tim</description>
      <pubDate>Fri, 30 Nov 2001 11:47:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/use-host-assoiation/m-p/975721#M24966</guid>
      <dc:creator>rahzan</dc:creator>
      <dc:date>2001-11-30T11:47:35Z</dc:date>
    </item>
  </channel>
</rss>

