<?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 VBA can't find second entry point  in  Fortran DLL file in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166386#M144484</link>
    <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;

&lt;P&gt;I have written many Fortran DLL's for Excel VBA, but this one has me really stuck.&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;Fortran version 11.1&amp;nbsp; using MSVS 2008;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;Excel 2007 VBA running on Windows 10&amp;nbsp; (Excel is 32-bit version)&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;My DLL performs two different tasks&lt;/P&gt;

&lt;P&gt;1. Given an acceleration time history (maybe 5-6000 points) compute velocity, and displacement&lt;/P&gt;

&lt;P&gt;2. Given the same acceleration time history, computes an earthquake response spectrum via Duhamel's integral.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Both of these I have done many times in Fortran, and in VBA. And I have used Fortran DLL's before to do this.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Fortran DLL important parts are shown below&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;
     
Subroutine AVD(Accel,Vel,Disp,VMax,DMax,Gravity,DeltaT,NumAcc)
CDEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS: "AVD" :: AVD
        
      INTEGER*4, INTENT (IN) ::NumAcc
	REAL, INTENT(IN) ::  Accel(20000),Gravity,DeltaT
	REAL, INTENT(OUT) :: Vel(20000),Disp(20000),VMax,DMax

	factor=Gravity*DeltaT/2.0
	factor2=DeltaT/2.0
	Vel(1)=0.0
	Disp(1)=0.0
	do 10 i=2,Numacc
	  Vel(i)=  etc....


 Subroutine EQSpectra(Accel,Xomega,Period,DisMax,VelMax, 
     !                     AccelMax,Zeta,DeltaT,NumAcc,MaxPts)
CDEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS: "EQSpectra" :: EQSpectra
      
      INTEGER*4, INTENT(IN) :: NumAcc,MaxPts
      REAL, INTENT(IN) ::  Accel(20000),Zeta(3),DeltaT
      REAL, INTENT(OUT) :: Xomega(201),Period(201)
	Real, Intent(out) :: DisMax(3,201),VelMax(3,201)
	Real, Intent(out) :: AccelMax(3,201)
       NAccDim =20000
       NumPts=NumAcc*2  
      if (NumPts .gt. MaxPts) then
         NumPts = MaxPts
       end if    etc.......&lt;/PRE&gt;

&lt;P&gt;The VBA code looks like so&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;Declare Sub EQSpectra Lib "I:\FortranSubs\spectra2018.dll" (Accel As Single, Xomega As Single, _
        Period As Single, DisMax As Single, VelMax As Single, _
        AccelMax As Single, Zeta As Single, DeltaT As Single, _
        NumAcc As Long, MaxPts As Long)

Declare Sub AVD Lib "I:\FortranSubs\spectra2018.dll" (Accel As Single, Vel As Single, Disp As Single, _
        Vel1Max As Single, Disp1Max As Single, Gravity As Single, DeltaT As Single, NumAcc As Long)&lt;/PRE&gt;

&lt;P&gt;.....then later in the VBA, I call the respective routines&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;
'compute Velocity, Displacement and write them in
Call AVD(Accel(1), Vel(1), Disp(1), Vel1Max, Disp1Max, Gravity, DeltaT, NumAcc)
For i = 1 To NumAcc
  ActiveSheet.Cells(5 + i, 1) = DeltaT * (i - 1)
  ActiveSheet.Cells(5 + i, 3) = Accel(i)
  ActiveSheet.Cells(5 + i, 4) = Vel(i)
  ActiveSheet.Cells(5 + i, 5) = Disp(i)
Next i

and later, the call to compute spectra....

Zeta(1) = 0#
Zeta(2) = 0.02
Zeta(3) = 0.05
Call EQSpectra(Accel(1), Xomega(1), Period(1), DisMax(1, 1), VelMax(1, 1), AccelMax(1, 1), _
     Zeta(1), DeltaT, NumAcc, MaxPts)&lt;/PRE&gt;

&lt;P&gt;I have been able to successfully run the VBA program past the call to AVD and plot the results on the spreadsheet, however, when I call the&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;EQSpectra routine I get:&amp;nbsp; &amp;nbsp;Run-time error&amp;nbsp; '453'&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Can't find DLL entry point EQSpectra in I:\FortranSubs\spectra2018.dll&lt;/P&gt;

&lt;P&gt;It is obviously finding spectra2018.dll since the AVD routine runs successfully. If anyone has a brilliant suggestion let me know. If not, I will break the routine down to a more simple one and hopefully get it to work correctly, then slowly build it back up again.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Sun, 08 Apr 2018 18:47:06 GMT</pubDate>
    <dc:creator>Ray__Richard</dc:creator>
    <dc:date>2018-04-08T18:47:06Z</dc:date>
    <item>
      <title>VBA can't find second entry point  in  Fortran DLL file</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166386#M144484</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;

&lt;P&gt;I have written many Fortran DLL's for Excel VBA, but this one has me really stuck.&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;Fortran version 11.1&amp;nbsp; using MSVS 2008;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;Excel 2007 VBA running on Windows 10&amp;nbsp; (Excel is 32-bit version)&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;My DLL performs two different tasks&lt;/P&gt;

&lt;P&gt;1. Given an acceleration time history (maybe 5-6000 points) compute velocity, and displacement&lt;/P&gt;

&lt;P&gt;2. Given the same acceleration time history, computes an earthquake response spectrum via Duhamel's integral.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Both of these I have done many times in Fortran, and in VBA. And I have used Fortran DLL's before to do this.&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Fortran DLL important parts are shown below&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;
     
Subroutine AVD(Accel,Vel,Disp,VMax,DMax,Gravity,DeltaT,NumAcc)
CDEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS: "AVD" :: AVD
        
      INTEGER*4, INTENT (IN) ::NumAcc
	REAL, INTENT(IN) ::  Accel(20000),Gravity,DeltaT
	REAL, INTENT(OUT) :: Vel(20000),Disp(20000),VMax,DMax

	factor=Gravity*DeltaT/2.0
	factor2=DeltaT/2.0
	Vel(1)=0.0
	Disp(1)=0.0
	do 10 i=2,Numacc
	  Vel(i)=  etc....


 Subroutine EQSpectra(Accel,Xomega,Period,DisMax,VelMax, 
     !                     AccelMax,Zeta,DeltaT,NumAcc,MaxPts)
CDEC$ ATTRIBUTES DLLEXPORT, STDCALL, REFERENCE, ALIAS: "EQSpectra" :: EQSpectra
      
      INTEGER*4, INTENT(IN) :: NumAcc,MaxPts
      REAL, INTENT(IN) ::  Accel(20000),Zeta(3),DeltaT
      REAL, INTENT(OUT) :: Xomega(201),Period(201)
	Real, Intent(out) :: DisMax(3,201),VelMax(3,201)
	Real, Intent(out) :: AccelMax(3,201)
       NAccDim =20000
       NumPts=NumAcc*2  
      if (NumPts .gt. MaxPts) then
         NumPts = MaxPts
       end if    etc.......&lt;/PRE&gt;

&lt;P&gt;The VBA code looks like so&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;Declare Sub EQSpectra Lib "I:\FortranSubs\spectra2018.dll" (Accel As Single, Xomega As Single, _
        Period As Single, DisMax As Single, VelMax As Single, _
        AccelMax As Single, Zeta As Single, DeltaT As Single, _
        NumAcc As Long, MaxPts As Long)

Declare Sub AVD Lib "I:\FortranSubs\spectra2018.dll" (Accel As Single, Vel As Single, Disp As Single, _
        Vel1Max As Single, Disp1Max As Single, Gravity As Single, DeltaT As Single, NumAcc As Long)&lt;/PRE&gt;

&lt;P&gt;.....then later in the VBA, I call the respective routines&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:csharp;"&gt;
'compute Velocity, Displacement and write them in
Call AVD(Accel(1), Vel(1), Disp(1), Vel1Max, Disp1Max, Gravity, DeltaT, NumAcc)
For i = 1 To NumAcc
  ActiveSheet.Cells(5 + i, 1) = DeltaT * (i - 1)
  ActiveSheet.Cells(5 + i, 3) = Accel(i)
  ActiveSheet.Cells(5 + i, 4) = Vel(i)
  ActiveSheet.Cells(5 + i, 5) = Disp(i)
Next i

and later, the call to compute spectra....

Zeta(1) = 0#
Zeta(2) = 0.02
Zeta(3) = 0.05
Call EQSpectra(Accel(1), Xomega(1), Period(1), DisMax(1, 1), VelMax(1, 1), AccelMax(1, 1), _
     Zeta(1), DeltaT, NumAcc, MaxPts)&lt;/PRE&gt;

&lt;P&gt;I have been able to successfully run the VBA program past the call to AVD and plot the results on the spreadsheet, however, when I call the&amp;nbsp;&lt;SPAN style="font-size: 1em;"&gt;EQSpectra routine I get:&amp;nbsp; &amp;nbsp;Run-time error&amp;nbsp; '453'&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;Can't find DLL entry point EQSpectra in I:\FortranSubs\spectra2018.dll&lt;/P&gt;

&lt;P&gt;It is obviously finding spectra2018.dll since the AVD routine runs successfully. If anyone has a brilliant suggestion let me know. If not, I will break the routine down to a more simple one and hopefully get it to work correctly, then slowly build it back up again.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 08 Apr 2018 18:47:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166386#M144484</guid>
      <dc:creator>Ray__Richard</dc:creator>
      <dc:date>2018-04-08T18:47:06Z</dc:date>
    </item>
    <item>
      <title>Fixed form is not your friend</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166387#M144485</link>
      <description>&lt;P&gt;Fixed form is not your friend. How long is that CDEC$ line for EQSpectra?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 14:08:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166387#M144485</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2018-04-09T14:08:31Z</dc:date>
    </item>
    <item>
      <title>Steve,  I hereby double your</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166388#M144486</link>
      <description>&lt;P&gt;Steve,&amp;nbsp; I hereby double your massive salary....The line ends at column....74 !!!&amp;nbsp; I would not have this problem if I put it on punch cards (yeah, I'm old enough to remember Fortran IV, WatFIV, IBM360, and Amdahl V7 at the old computing center at UMich Ann Arbor, circa 1973).&amp;nbsp; Let me take off my stupid hat, and redo the Fortran code to free format/ F90 and be happy again. Thanks again.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 15:09:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166388#M144486</guid>
      <dc:creator>Ray__Richard</dc:creator>
      <dc:date>2018-04-09T15:09:16Z</dc:date>
    </item>
    <item>
      <title>Problem solved. Sheesh!</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166389#M144487</link>
      <description>&lt;P&gt;Problem solved. Sheesh!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 16:05:33 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VBA-can-t-find-second-entry-point-in-Fortran-DLL-file/m-p/1166389#M144487</guid>
      <dc:creator>Ray__Richard</dc:creator>
      <dc:date>2018-04-09T16:05:33Z</dc:date>
    </item>
  </channel>
</rss>

