<?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 Quote:mwindham wrote: in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156272#M141659</link>
    <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mwindham wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This compiles except for the error#6623 above, but I would have thought I should have a CPI1 C_PTR declared and used:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;INTEGER :: I0 =1
  INTEGER(C_INT), VOLATILE, TARGET :: I1 = 2
  INTEGER :: I2= 8
  I0 = INTERLOCKEDEXCHANGEADD(I1,I2)&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can try this, note the IA32 (effectively 32-bit) environment.&amp;nbsp; On x64 (64-bit), use InterLockedExchangeAdd64.&lt;/P&gt;

&lt;PRE class="brush:fortran; class-name:dark;"&gt;   use, intrinsic :: iso_c_binding, only : c_long

   interface
      function InterlockedExchangeAdd(Addend,Value) result(r) bind(C, name="InterlockedExchangeAdd")
      !DIR$ ATTRIBUTES STDCALL :: InterlockedExchangeAdd

      ! MSDN function prototype:
      ! &lt;A href="https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedexchangeadd" target="_blank"&gt;https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedexchangeadd&lt;/A&gt;
      ! LONG InterlockedExchangeAdd(
      !   LONG volatile *Addend,
      !   LONG          Value
      !);
         import :: c_long
         implicit none
         ! Argument list
         integer(c_long), volatile, intent(inout) :: Addend
         integer(c_long), value, intent(in)       :: Value
         ! Function result
         integer(c_long) :: r
      end function
   end interface

   ! Local variables
   integer(c_long) :: I0 = 1
   integer(c_long), volatile :: I1 = 2
   integer(c_long) :: I2 = 8

   I0 = InterlockedExchangeAdd(I1, I2)

   print *, "I0 = ", I0

   stop

end
&lt;/PRE&gt;

&lt;P&gt;Upon compilation, linking, and execution:&lt;/P&gt;

&lt;PRE class="brush:plain; class-name:dark;"&gt;
C:\Temp&amp;gt;ifort /standard-semantics /warn:all /stand:f18 p.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on IA-32, Version 19.1.0.085 Pre-Release Beta Build 20190522
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

p.f90(5): warning #7025: This directive is not standard F2018.
      !DIR$ ATTRIBUTES STDCALL :: InterlockedExchangeAdd
------------^
Microsoft (R) Incremental Linker Version 14.21.27702.2
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:p.exe
-subsystem:console
p.obj

C:\Temp&amp;gt;p.exe
 I0 =  2

C:\Temp&amp;gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 03 Sep 2019 19:32:37 GMT</pubDate>
    <dc:creator>FortranFan</dc:creator>
    <dc:date>2019-09-03T19:32:37Z</dc:date>
    <item>
      <title>Interface for winnt.h InterlockedAdd and linking</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156266#M141653</link>
      <description>&lt;P&gt;So far I have gone into a rabbit hole. InterlockedAdd is an intrinsic to MS, not in a lib, so I guess I have to make a dll in MSVC that invokes InterlockedAdd and returns result.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;
&amp;nbsp;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Sep 2019 03:22:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156266#M141653</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-03T03:22:44Z</dc:date>
    </item>
    <item>
      <title>Kernel32.f90 has:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156267#M141654</link>
      <description>&lt;P&gt;Kernel32.f90 has:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;INTERFACE 
FUNCTION InterlockedExchangeAdd( &amp;amp;
        Addend, &amp;amp;
        Value)
import
  integer(LONG) :: InterlockedExchangeAdd ! LONG
    !DEC$ ATTRIBUTES DEFAULT, DECORATE, ALIAS:'__ifort_InterlockedExchangeAdd' :: InterlockedExchangeAdd
  integer(LONG), intent(INOUT) :: Addend ! LPLONG Addend
    !DEC$ ATTRIBUTES REFERENCE, IGNORE_LOC :: Addend
  integer(LONG), intent(IN) ::  Value ! LONG Value
    !DEC$ ATTRIBUTES VALUE :: Value
 END FUNCTION
END INTERFACE
&lt;/PRE&gt;

&lt;P&gt;This returns the old value prior to interlocked add&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 12:44:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156267#M141654</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2019-09-03T12:44:25Z</dc:date>
    </item>
    <item>
      <title>For completeness, here are</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156268#M141655</link>
      <description>&lt;P&gt;For completeness, here are the set of interlocked operations defined in KERNEL32:&lt;/P&gt;&lt;P&gt;InterlockedIncrement,&amp;nbsp;InterlockedDecrement,&amp;nbsp;InterlockedExchange,&amp;nbsp;InterlockedExchangeAdd,&amp;nbsp;InterlockedCompareExchange&lt;/P&gt;&lt;P&gt;For coarray programs, there are a bunch of ATOMIC_xxx intrinsics, such as ATOMIC_ADD.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 13:17:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156268#M141655</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2019-09-03T13:17:00Z</dc:date>
    </item>
    <item>
      <title>Also, you can use OpenMP</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156269#M141656</link>
      <description>&lt;P&gt;Also, you can use OpenMP ATOMIC&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;!$omp atomic capture
oldValue = x
x = x + expression

! .OR.

!$omp atomic capture
x = x + expression
newValue = x
&lt;/PRE&gt;

&lt;P&gt;The first returns prior value, the second returns resultant value.&lt;/P&gt;
&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 14:31:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156269#M141656</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2019-09-03T14:31:00Z</dc:date>
    </item>
    <item>
      <title>@jimdempseyatthecove:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156270#M141657</link>
      <description>&lt;P&gt;@jimdempseyatthecove:&lt;/P&gt;&lt;P&gt;Thanks, I did not know about source like kernel32.f90.&amp;nbsp; I was dumbin'ing kernel32.lib and getting nowhere.&amp;nbsp; Using the code gets&lt;/P&gt;&lt;P&gt;"error #6623: The procedure name of the INTERFACE block conflicts with a name in the encompassing scoping unit. &amp;nbsp; [INTERLOCKEDEXCHANGEADD]".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 18:35:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156270#M141657</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-03T18:35:50Z</dc:date>
    </item>
    <item>
      <title>This compiles except for the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156271#M141658</link>
      <description>&lt;P&gt;This compiles except for the error#6623 above, but I would have thought I should have a CPI1 C_PTR declared and used:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;INTEGER :: I0 =1
  INTEGER(C_INT), VOLATILE, TARGET :: I1 = 2
  INTEGER :: I2= 8
  I0 = INTERLOCKEDEXCHANGEADD(I1,I2)&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 18:44:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156271#M141658</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-03T18:44:44Z</dc:date>
    </item>
    <item>
      <title>Quote:mwindham wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156272#M141659</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mwindham wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This compiles except for the error#6623 above, but I would have thought I should have a CPI1 C_PTR declared and used:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;INTEGER :: I0 =1
  INTEGER(C_INT), VOLATILE, TARGET :: I1 = 2
  INTEGER :: I2= 8
  I0 = INTERLOCKEDEXCHANGEADD(I1,I2)&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;You can try this, note the IA32 (effectively 32-bit) environment.&amp;nbsp; On x64 (64-bit), use InterLockedExchangeAdd64.&lt;/P&gt;

&lt;PRE class="brush:fortran; class-name:dark;"&gt;   use, intrinsic :: iso_c_binding, only : c_long

   interface
      function InterlockedExchangeAdd(Addend,Value) result(r) bind(C, name="InterlockedExchangeAdd")
      !DIR$ ATTRIBUTES STDCALL :: InterlockedExchangeAdd

      ! MSDN function prototype:
      ! &lt;A href="https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedexchangeadd" target="_blank"&gt;https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedexchangeadd&lt;/A&gt;
      ! LONG InterlockedExchangeAdd(
      !   LONG volatile *Addend,
      !   LONG          Value
      !);
         import :: c_long
         implicit none
         ! Argument list
         integer(c_long), volatile, intent(inout) :: Addend
         integer(c_long), value, intent(in)       :: Value
         ! Function result
         integer(c_long) :: r
      end function
   end interface

   ! Local variables
   integer(c_long) :: I0 = 1
   integer(c_long), volatile :: I1 = 2
   integer(c_long) :: I2 = 8

   I0 = InterlockedExchangeAdd(I1, I2)

   print *, "I0 = ", I0

   stop

end
&lt;/PRE&gt;

&lt;P&gt;Upon compilation, linking, and execution:&lt;/P&gt;

&lt;PRE class="brush:plain; class-name:dark;"&gt;
C:\Temp&amp;gt;ifort /standard-semantics /warn:all /stand:f18 p.f90
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on IA-32, Version 19.1.0.085 Pre-Release Beta Build 20190522
Copyright (C) 1985-2019 Intel Corporation.  All rights reserved.

p.f90(5): warning #7025: This directive is not standard F2018.
      !DIR$ ATTRIBUTES STDCALL :: InterlockedExchangeAdd
------------^
Microsoft (R) Incremental Linker Version 14.21.27702.2
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:p.exe
-subsystem:console
p.obj

C:\Temp&amp;gt;p.exe
 I0 =  2

C:\Temp&amp;gt;&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 19:32:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156272#M141659</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2019-09-03T19:32:37Z</dc:date>
    </item>
    <item>
      <title>I think the error#6623 above</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156273#M141660</link>
      <description>&lt;PRE class="brush:fortran; class-name:dark;"&gt;I think the error#6623 above was a clash with something already in kernel32.f90. This works ith LOC(i1) but does not compile with the C_LOC(I1) arg. In debugger i1 is 10.

program Interlocked1
USE KERNEL32
use iso_c_binding
    implicit none

    ! Variables
  INTEGER :: I0 =1
  INTEGER(C_INT), VOLATILE, TARGET :: I1 = 2
  INTEGER :: I2= 8
  
    ! Body of Interlocked
    
    I0 = INTERLOCKEDEXCHANGEADD(LOC(I1),I2)
    !I0 = INTERLOCKEDEXCHANGEADD(C_LOC(I1),I2)
    print *, 'Hello World'

    end program Interlocked1
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 20:08:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156273#M141660</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-03T20:08:09Z</dc:date>
    </item>
    <item>
      <title>Thanks to all.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156274#M141661</link>
      <description>&lt;P&gt;Thanks to all.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 20:27:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156274#M141661</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-03T20:27:04Z</dc:date>
    </item>
    <item>
      <title>Quote:mwindham wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156275#M141662</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mwindham wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think the error#6623 above was a clash with something already in kernel32.f90. This works ith LOC(i1) but does not compile with the C_LOC(I1) arg. In debugger i1 is 10. ..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer to the documentation for the non-standard LOC function, an Intel Fortran extension, and the standard-supported intrinsic function of C_LOC from ISO_C_BINDING intrinsic module (https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-c-loc) whose return type in a Fortran-standard defined derived type of C_PTR and not what the interface for InterLockedExchangeAdd expects,&lt;/P&gt;&lt;P&gt;Separately, the interface declaration is already to setup to do the 'work' in terms of 'pass by reference' of the first parameter in that function, so you don't need to use LOC nor C_LOC with it.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Sep 2019 23:39:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156275#M141662</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2019-09-03T23:39:00Z</dc:date>
    </item>
    <item>
      <title>@FortranFan</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156276#M141663</link>
      <description>&lt;P&gt;@FortranFan&lt;/P&gt;&lt;P&gt;if LOC(I1) &amp;nbsp;was omitted, I got exception for trying to access address 0x00000002.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 01:40:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156276#M141663</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-04T01:40:15Z</dc:date>
    </item>
    <item>
      <title>Quote:mwindham wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156277#M141664</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mwindham wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@FortranFan&lt;/P&gt;&lt;P&gt;if LOC(I1) &amp;nbsp;was omitted, I got exception for trying to access address 0x00000002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's straight forward with using the Windows OS included C++ function in kernel32.dll from Microsoft as shown above in Quote #7.&lt;/P&gt;&lt;P&gt;I'm unsure of the interface with alias '__ifort_InterlockedExchangeAdd' in&amp;nbsp;Intel Fortran provided kernel32.f90 file.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 02:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156277#M141664</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2019-09-04T02:04:00Z</dc:date>
    </item>
    <item>
      <title>@FortranFan</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156278#M141665</link>
      <description>&lt;P&gt;@FortranFan&lt;/P&gt;&lt;P&gt;Your codes works, as does mine(both compiled 32-bit). Mine requires LOC and uses kernel32.f90 interface; yours is explicit.&lt;/P&gt;&lt;P&gt;So does this, without TARGET:&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;program Interlocked1a

    USE KERNEL32
    use iso_c_binding
    implicit none
    ! Variables
    INTEGER :: I0 =1
    INTEGER, VOLATILE :: I1 = 2
    INTEGER :: I2= 8
    ! Body of Interlocked
    I0 = INTERLOCKEDEXCHANGEADD(LOC(I1),I2)
    print *, "I1 = ", I1
    end program Interlocked1a&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 02:39:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156278#M141665</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-04T02:39:00Z</dc:date>
    </item>
    <item>
      <title>Quote #2 was right and I got</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156279#M141666</link>
      <description>&lt;P&gt;Quote #2 was right&amp;nbsp;and I got it wrong by trying to redo interface in kernel32.f90 in mine first time around. I am confused about what&amp;nbsp;IGNORE_LOC does? It seems a LOC for Addend is needed.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 03:37:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156279#M141666</guid>
      <dc:creator>MWind2</dc:creator>
      <dc:date>2019-09-04T03:37:00Z</dc:date>
    </item>
    <item>
      <title>Quote:mwindham wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156280#M141667</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;mwindham wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quote #2 was right&amp;nbsp;and I got it wrong by trying to redo interface in kernel32.f90 in mine first time around. I am confused about what&amp;nbsp;IGNORE_LOC does? It seems a LOC for Addend is needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are able to contact Intel Support, you may want to inquire with them re: Kernel32.f90 interface for Fortran.&amp;nbsp; One would have thought the 'IGNORE_LOC' attribute is present in the interface so that one doesn't need to use LOC, so something appears amiss.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2019 15:27:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156280#M141667</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2019-09-04T15:27:20Z</dc:date>
    </item>
    <item>
      <title>Jim has shown the x64</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156281#M141668</link>
      <description>&lt;P&gt;Jim has shown the x64 declaration of that routine.&amp;nbsp; On x64, Windows expects this API to be implemented by a compiler intrinsic and consequently it is not exported from kernel32.dll.&amp;nbsp; ifort's runtime implements the API itself - hence the alias to an ifort runtime helper routine.&amp;nbsp; The declaration and implementation of that helper routine is such that LOC does not have to be used (default calling convention, the Addend argument is passed by reference, IGNORE_LOC will do what it suggests).&lt;/P&gt;&lt;P&gt;The definition for x86 is different - LOC is required.&amp;nbsp; On x86 this API is implemented using an export from kernel32.lib, the declaration is consistent with other API's (stdcall calling convention, the argument is passed by value, consequently the value passed needs to be the address of the thing that you want to exchange and add).&lt;/P&gt;&lt;P&gt;But... why are you calling this API?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Sep 2019 17:54:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Interface-for-winnt-h-InterlockedAdd-and-linking/m-p/1156281#M141668</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2019-09-05T17:54:49Z</dc:date>
    </item>
  </channel>
</rss>

