<?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 bizarre mixed language Fortran/C memory problem in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/bizarre-mixed-language-Fortran-C-memory-problem/m-p/932223#M15109</link>
    <description>I'm calling a function located in a fortran .dll file.  This    &lt;BR /&gt;function does nothing more than:   &lt;BR /&gt;o  input a matrix (3 by 7)   &lt;BR /&gt;o  print the elements of each row   &lt;BR /&gt;o  multiply the elements by 2, storing this to an output array   &lt;BR /&gt;o  prints the result to the screen   &lt;BR /&gt;o  return.   &lt;BR /&gt;   &lt;BR /&gt;The C driver program:   &lt;BR /&gt;o  allocates and initializes an input and an output array  &lt;BR /&gt;o  prints the input array  &lt;BR /&gt;o  calls the fortran function, providing both arrays and their  &lt;BR /&gt;   dimensions.  &lt;BR /&gt;o  prints the result.     &lt;BR /&gt;   &lt;BR /&gt;I find that when the fortran function returns, all values in the output   &lt;BR /&gt;array are correctly set but the printout of the output array (done within fortran) hasn't happened.  The input array printout appeared on the screen. but it's as if the write statements after multiply by 2 were   &lt;BR /&gt;never executed.  Very strange!  Within C now, I then enter a do loop which prints out the values of the output matrix.  The first time printf is called, the value of my do loop index is overwritten.  It is fine before I step over printf, but is slammed during that function call.  This exact code runs perfectly fine on a unix box.  I've purified it and am certain neither the fortran nor the C code violates any memory boundaries.   &lt;BR /&gt;   &lt;BR /&gt;Is there some issue related to VC++ and Visual fortran when it comes   &lt;BR /&gt;to mixed language programming?  Has this happened to anyone else?  My    &lt;BR /&gt;feeling is that the problem is happening in the fortran because the   &lt;BR /&gt;printout fails to appear on the screen after the multiply by 2.   &lt;BR /&gt;   &lt;BR /&gt;Thanks for any help,</description>
    <pubDate>Mon, 18 Dec 2000 10:03:09 GMT</pubDate>
    <dc:creator>wilf-kruggel</dc:creator>
    <dc:date>2000-12-18T10:03:09Z</dc:date>
    <item>
      <title>bizarre mixed language Fortran/C memory problem</title>
      <link>https://community.intel.com/t5/Software-Archive/bizarre-mixed-language-Fortran-C-memory-problem/m-p/932223#M15109</link>
      <description>I'm calling a function located in a fortran .dll file.  This    &lt;BR /&gt;function does nothing more than:   &lt;BR /&gt;o  input a matrix (3 by 7)   &lt;BR /&gt;o  print the elements of each row   &lt;BR /&gt;o  multiply the elements by 2, storing this to an output array   &lt;BR /&gt;o  prints the result to the screen   &lt;BR /&gt;o  return.   &lt;BR /&gt;   &lt;BR /&gt;The C driver program:   &lt;BR /&gt;o  allocates and initializes an input and an output array  &lt;BR /&gt;o  prints the input array  &lt;BR /&gt;o  calls the fortran function, providing both arrays and their  &lt;BR /&gt;   dimensions.  &lt;BR /&gt;o  prints the result.     &lt;BR /&gt;   &lt;BR /&gt;I find that when the fortran function returns, all values in the output   &lt;BR /&gt;array are correctly set but the printout of the output array (done within fortran) hasn't happened.  The input array printout appeared on the screen. but it's as if the write statements after multiply by 2 were   &lt;BR /&gt;never executed.  Very strange!  Within C now, I then enter a do loop which prints out the values of the output matrix.  The first time printf is called, the value of my do loop index is overwritten.  It is fine before I step over printf, but is slammed during that function call.  This exact code runs perfectly fine on a unix box.  I've purified it and am certain neither the fortran nor the C code violates any memory boundaries.   &lt;BR /&gt;   &lt;BR /&gt;Is there some issue related to VC++ and Visual fortran when it comes   &lt;BR /&gt;to mixed language programming?  Has this happened to anyone else?  My    &lt;BR /&gt;feeling is that the problem is happening in the fortran because the   &lt;BR /&gt;printout fails to appear on the screen after the multiply by 2.   &lt;BR /&gt;   &lt;BR /&gt;Thanks for any help,</description>
      <pubDate>Mon, 18 Dec 2000 10:03:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/bizarre-mixed-language-Fortran-C-memory-problem/m-p/932223#M15109</guid>
      <dc:creator>wilf-kruggel</dc:creator>
      <dc:date>2000-12-18T10:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: bizarre mixed language Fortran/C memory problem</title>
      <link>https://community.intel.com/t5/Software-Archive/bizarre-mixed-language-Fortran-C-memory-problem/m-p/932224#M15110</link>
      <description>First of all, how does the DLL routine "print" the data?  Unless the calling program has allocated a console window, it's likely that any I/O to the "screen" will fail.&lt;BR /&gt;&lt;BR /&gt;You also need to be aware that Visual Fortran, by default, uses the STDCALL calling mechanism. If you don't accomodate this in declarations either in the C or Fortran code, you'll corrupt the stack. &lt;BR /&gt;&lt;BR /&gt;Please read the chapter on mixed-language programming in the Visual Fortran Programmer's Guide - you'll find it very helpful.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Tue, 19 Dec 2000 00:59:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/bizarre-mixed-language-Fortran-C-memory-problem/m-p/932224#M15110</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2000-12-19T00:59:49Z</dc:date>
    </item>
  </channel>
</rss>

