<?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: How to create Fortran array referencing SafeArrayAccessData in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348497#M159157</link>
    <description>&lt;P&gt;I've been using x1.xlsm, dfad and dcpp1, no progress with fortran.&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jan 2022 21:02:59 GMT</pubDate>
    <dc:creator>MWind2</dc:creator>
    <dc:date>2022-01-04T21:02:59Z</dc:date>
    <item>
      <title>How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347706#M159067</link>
      <description>&lt;P&gt;VBArray INOUT length known&lt;BR /&gt;integer(C_INTPTR_T) :: dptr&lt;BR /&gt;...&lt;BR /&gt;iRes=SafeArrayAccessData(VBArray,dptr)&lt;BR /&gt;dptr address is starting point of one dimensional c array of real{8}&lt;/P&gt;
&lt;P&gt;I want to put it in a Fortran array so I can see it in debugger for one reason, but I want the Fortran array to reference the underlying data and not be a copy. Intention would be changes to data in Fortran array would be preserved in dptr array.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 06:29:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347706#M159067</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2021-12-31T06:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347781#M159076</link>
      <description>&lt;P&gt;Something like this:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;use, intrinsic :: iso_c_binding
...
real(c_double), pointer :: array_data(:)
...
call c_f_pointer(transfer(dptr,c_null_ptr),array_data,[array_size])&lt;/LI-CODE&gt;
&lt;P&gt;where array_size is the number of elements in the array (can be a variable or a constant). After this, array_data is your one-dimensional array, no copy done.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 17:30:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347781#M159076</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2021-12-31T17:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347814#M159080</link>
      <description>&lt;P&gt;I seem to be getting an&amp;nbsp;Exception thrown at 0x00007FF88E912D83 (df.dll) in EXCEL.EXE: 0xC0000005: Access violation writing location 0x0000000000000000 because of the "c_null_ptr" in the transfer.&amp;nbsp; Data is "adptr"(changed from dptr as dptr used as another pointer).&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 21:00:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347814#M159080</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2021-12-31T21:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347816#M159081</link>
      <description>&lt;P&gt;C_NULL_PTR as the second argument to TRANSFER is just the "mold" - it provides the type to interpret the source (first argument) as.&amp;nbsp; It is not accessed as data. If you got an access violation, then adptr was zero. I suggest adding some logging to your code (write to a file perhaps.)&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 21:08:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347816#M159081</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2021-12-31T21:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347830#M159083</link>
      <description>&lt;P&gt;I attached a vs2022 folder with all inside. Excel is 64 bit and projects.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Dec 2021 23:06:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347830#M159083</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2021-12-31T23:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347843#M159089</link>
      <description>&lt;P&gt;Two errors. First, you omitted the size argument I specified to C_F_POINTER. Second, you treated the array as if it were zero-origin, but the array you get from C_F_POINTER is one-origin. (This could be finessed with pointer assignment redeclaring the bounds, but that seems unnecessary.)&lt;/P&gt;
&lt;P&gt;I attach my modified df.f90. I didn't change anything else.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 02:10:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347843#M159089</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2022-01-01T02:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347846#M159090</link>
      <description>&lt;P&gt;Thank you! I spent all day trying for magic incantations. Intention here was to show that a Excel vba array of doubles used in calculations could be easily sent to a fortran dll and the results sent back in a position(s) in the array for&amp;nbsp;&lt;A href="https://community.intel.com/t5/Intel-Fortran-Compiler/Reading-Data-from-an-Excel-Spreadsheet/m-p/1347841" target="_blank" rel="noopener"&gt;Re: Reading Data from an Excel Spreadsheet? - Page 2 - Intel Communities&lt;/A&gt;. One change was made in formula&amp;nbsp;&lt;/P&gt;
&lt;P&gt;array_data(4)=PI*array_data(1)*array_data(1)*array_data(2)*array_data(3)/4.0 for weight of cylinder agree with others I had Option 0 on in vba, but array in fortran was [1,4]. Without mucking it up, how to set array_data to be [0,3]?&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 03:02:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347846#M159090</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-01T03:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347878#M159093</link>
      <description>&lt;P&gt;Add a new array pointer declaration as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;real(8), pointer :: array_data(:), array_data1(:)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then replace the C_F_POINTER call with these two lines:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;    call c_f_pointer(cptr,array_data1,[4])
    array_data(0:) =&amp;gt; array_data1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had thought I could do:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;array_data(0:) =&amp;gt; array_data&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but that didn't work, for reasons still unclear to me (it caused array_data to become disassociated - this MIGHT be a bug, and I will investigate further.)&lt;/P&gt;
&lt;P&gt;Edit: I can't reproduce the problem in a simple test. Shrug....&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 14:28:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347878#M159093</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2022-01-01T14:28:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347898#M159098</link>
      <description>&lt;P&gt;Thank you! Sometimes I'm "cset" in my ways if permitted, and I would have still been looking for Rosetta stone.&lt;/P&gt;
&lt;P&gt;While trying to find things that applied in books, I was thinking that most write to the overview, not that there is anything wrong with that, but a compendium of use questions and answers would be more useful at times. It seems forums nearly do the job, but there are problems with that like too much archiving or deleting of still relevant material, besides signal to noise.&lt;/P&gt;</description>
      <pubDate>Sat, 01 Jan 2022 20:22:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1347898#M159098</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-01T20:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348171#M159122</link>
      <description>&lt;P&gt;Is it possible to do this for the two dimensional array? So far I have had no success?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The bounds part works.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 22:28:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348171#M159122</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-03T22:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348187#M159123</link>
      <description>&lt;P&gt;Look again at the VB.NET-Safearrays sample, from which you borrowed some code. It illustrates how to access arrays of any dimension.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 23:35:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348187#M159123</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2022-01-03T23:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348203#M159124</link>
      <description>&lt;P&gt;The looping into each one array goes fine, but combining or assigning those to a Fortran 2d array is where I am not getting.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 01:41:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348203#M159124</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-04T01:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348457#M159151</link>
      <description>&lt;P&gt;Please zip and attach what you have now, and I'll take a look.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 19:34:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348457#M159151</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2022-01-04T19:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348497#M159157</link>
      <description>&lt;P&gt;I've been using x1.xlsm, dfad and dcpp1, no progress with fortran.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 21:02:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348497#M159157</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-04T21:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348508#M159159</link>
      <description>&lt;P&gt;You have a lot of code commented out, but I see this:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;cptr=transfer(adptr,c_null_ptr)
  call c_f_pointer(cptr,array_data,[12])
  array_data(0:) =&amp;gt; array_data1&lt;/LI-CODE&gt;
&lt;P&gt;That should be array_data1 in the second line.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Where is the code where you're "assigning to a 2D Fortran array"?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 21:41:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348508#M159159</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2022-01-04T21:41:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348514#M159160</link>
      <description>&lt;P&gt;I was getting nowhere but locking exceptions, so this was what I was doing . Trying to do in fortran what was done in dcpp1 and so far getting nowhere.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 22:21:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348514#M159160</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-04T22:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348539#M159162</link>
      <description>&lt;P&gt;I have not tried to edit your sources, but 1) You still have that error on the call to c_f_pointer, and 2) unlike the C++ code, you unlock the SafeArray before accessing it.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 23:53:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348539#M159162</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2022-01-04T23:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348574#M159164</link>
      <description>&lt;P&gt;When I use&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt;readloop:  do
  ires=SafeArrayGetElemsize(VBArray)
  ires = SafeArrayGetElement (VBArray, indexes(1), loc(adptr))
  !
  cptr=transfer(adptr,c_null_ptr)
  call c_f_pointer(cptr,array_data,[ilen])  
  call c_f_pointer(cptr,array_data1,[ilen])
  array_data(0:) =&amp;gt; array_data1
  !
  !  array_data1(3)=PI*array_data1(0)*array_data1(0)*array_data1(1)*array_data1(2)
  do i = nbounds, 1, -1
     indexes(i) = indexes(i) + 1
     if (indexes(i) &amp;lt;= bounds(i)%ub) exit
       indexes(i) = bounds(i)%lb
     if (i == 1) exit readloop
  end do
  end do readloop
 iRes=SafeArrayUnlock(VBArray)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get an element size of 8, which does not seem to be an array size. Maybe I'm reading it wrong but GetElement may be just a double.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 02:22:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348574#M159164</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-05T02:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348575#M159165</link>
      <description>&lt;P&gt;Got a fortran array with such but maybe order wrong:&lt;/P&gt;
&lt;LI-CODE lang="fortran"&gt; iRes=SafeArrayLock(VBArray)
  indexes = bounds%lb  ! Initialize to all lower bounds
  ilen=bounds(2)%ub-bounds(2)%lb
  ires=SafeArrayGetElemsize(VBArray)
  !ires = SafeArrayPtrOfIndex(VBArray, indx, cptr0)
  ires=SafeArrayAccessData(VBArray,adptr)
  !ires = SafeArrayGetElement (VBArray, indexes(1), loc(adptr))
  !
  cptr=transfer(adptr,c_null_ptr)
  call c_f_pointer(cptr,array_data,[12])  
  !call c_f_pointer(cptr,array_data1,[12])
  !array_data(0:) =&amp;gt; array_data1
  !
  !  array_data1(3)=PI*array_data1(0)*array_data1(0)*array_data1(1)*array_data1(2)
 
  iRes=SafeArrayUnlock(VBArray)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Jan 2022 03:00:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348575#M159165</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-05T03:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to create Fortran array referencing SafeArrayAccessData</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348583#M159166</link>
      <description>&lt;P&gt;Not pretty but curious.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 04:34:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/How-to-create-Fortran-array-referencing-SafeArrayAccessData/m-p/1348583#M159166</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2022-01-05T04:34:58Z</dc:date>
    </item>
  </channel>
</rss>

