<?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>tema Problem with multiple string variables returning to EXCEL VBA en Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-multiple-string-variables-returning-to-EXCEL-VBA/m-p/886243#M76814</link>
    <description>&lt;P&gt;I have downloaded V11.1 for evaluation and am having a problem converting a CVF V6.6 DLL routine. The problem seems to be matching the calling arguments. In the CVF version the VBA code defines the string variable followed by the string length and the FORTRAN code just includes the string variable. With V11.1 I seem to have to include both the string variable and the string length. With this, I get all of the correct values in the FORTRAN code and I output those values in my test code. But then EXCEL gets an error when the FORTRAN code does the RETURN.&lt;/P&gt;
&lt;P&gt;I could not find a specific answer to this in the list of issues in the forum, so I am hopefull someone can straighten me out.&lt;/P&gt;
&lt;P&gt;Below is the Code I have in my VBA module, the code in the FORTRAN test file, and the output data generated when the program is run, followed by the error I get from EXCEL.&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * EXCEL VBA * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Dim LngYearToRun As Long&lt;/P&gt;
&lt;P&gt;Private Const LngLength1 As Long = 140&lt;/P&gt;
&lt;P&gt;Private Const LngLength2 As Long = 150&lt;/P&gt;
&lt;P&gt;Private Const LngLength3 As Long = 160&lt;/P&gt;
&lt;P&gt;Dim LngValue As Long&lt;/P&gt;
&lt;P&gt;Dim StrUserPath1 As String * 160&lt;/P&gt;
&lt;P&gt;Dim StrUserPath2 As String * 160&lt;/P&gt;
&lt;P&gt;Dim StrUserPath3 As String * 160&lt;/P&gt;
&lt;P&gt;Private Declare Sub DISPATCHDLL Lib "H:\\Visual Studio 2008\\Projects\\Dll1\\Dll1\\Release\\DLL1.dll" (LngYearToRun As Long, ByVal StrUserPath1 As String, LngLength1 As Long, ByVal StrUserPath2 As String, LngLength2 As Long, ByVal StrUserPath3 As String, LngLength3 As Long, LngValue As Long)&lt;/P&gt;
&lt;P&gt;Sub DealemDLLSub()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LngYearToRun = 2010&lt;/P&gt;
&lt;P&gt;LngValue = 256&lt;/P&gt;
&lt;P&gt;StrUserPath1 = "User Path Name 1"&lt;/P&gt;
&lt;P&gt;StrUserPath2 = "User Path Name 2"&lt;/P&gt;
&lt;P&gt;StrUserPath3 = "User Path Name 3"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Cells(7, 1).Value = "Before Call"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Call DISPATCHDLL(LngYearToRun, StrUserPath1, LngLength1, StrUserPath2, LngLength2, StrUserPath3, LngLength3, LngValue)&lt;/P&gt;
&lt;P&gt;Cells(9, 1) = Time&lt;/P&gt;
&lt;P&gt;Cells(7, 1).Value = "FINISHED"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * Program * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Subroutine DispatchDLL(YearToRunIN,Path1,n1,Path2,n2,Path3,n3,n4)&lt;/P&gt;
&lt;P&gt;INTEGER N&lt;/P&gt;
&lt;P&gt;INTEGER N1,N2,N3,N4,N5,N6&lt;/P&gt;
&lt;P&gt;INTEGER ArrayPointer&lt;/P&gt;
&lt;P&gt;INTEGER YearToRunIN, NumUnitsIN, Length&lt;/P&gt;
&lt;P&gt;Character (len=140) Path1&lt;/P&gt;
&lt;P&gt;Character (len=150) Path2&lt;/P&gt;
&lt;P&gt;Character (len=160) Path3&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;!dec$ attributes dllexport :: DispatchDLL&lt;/P&gt;
&lt;P&gt;!dec$ attributes alias : "DISPATCHDLL" :: DispatchDLL&lt;/P&gt;
&lt;P&gt;!dec$ attributes stdcall, REFERENCE :: DispatchDLL&lt;/P&gt;
&lt;P&gt;OPEN(UNIT=999,FILE='H:\\INTEL\\INTEL_errorlog.dat',STATUS='REPLACE',ERR=991)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) 'Before write'&lt;/P&gt;
&lt;P&gt;WRITE (999,*) YearToRunIN&lt;/P&gt;
&lt;P&gt;WRITE (999,*) TRIM(Path1)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N1&lt;/P&gt;
&lt;P&gt;WRITE (999,*) TRIM(Path2)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N2&lt;/P&gt;
&lt;P&gt;WRITE (999,*) TRIM(Path3)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N3&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N4&lt;/P&gt;
&lt;P&gt;WRITE (999,*) 'After write'&lt;/P&gt;
&lt;P&gt;CLOSE (999)&lt;/P&gt;
&lt;P&gt;RETURN&lt;/P&gt;
&lt;P&gt;991 RETURN&lt;/P&gt;
&lt;P&gt;END&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * INTEL_errorlog.dat * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Before write&lt;/P&gt;
&lt;P&gt;2010&lt;/P&gt;
&lt;P&gt;User Path Name 1&lt;/P&gt;
&lt;P&gt;140&lt;/P&gt;
&lt;P&gt;User Path Name 2&lt;/P&gt;
&lt;P&gt;150&lt;/P&gt;
&lt;P&gt;User Path Name 3&lt;/P&gt;
&lt;P&gt;160&lt;/P&gt;
&lt;P&gt;256&lt;/P&gt;
&lt;P&gt;After write&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * EXCEL ERROR * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience.&lt;/P&gt;
&lt;P&gt;When I click on Debug I get&lt;/P&gt;
&lt;P&gt;An unhandled win32 exception occurred in EXCEL.EXE[2508]&lt;/P&gt;</description>
    <pubDate>Mon, 22 Feb 2010 19:14:41 GMT</pubDate>
    <dc:creator>jlgilber</dc:creator>
    <dc:date>2010-02-22T19:14:41Z</dc:date>
    <item>
      <title>Problem with multiple string variables returning to EXCEL VBA</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-multiple-string-variables-returning-to-EXCEL-VBA/m-p/886243#M76814</link>
      <description>&lt;P&gt;I have downloaded V11.1 for evaluation and am having a problem converting a CVF V6.6 DLL routine. The problem seems to be matching the calling arguments. In the CVF version the VBA code defines the string variable followed by the string length and the FORTRAN code just includes the string variable. With V11.1 I seem to have to include both the string variable and the string length. With this, I get all of the correct values in the FORTRAN code and I output those values in my test code. But then EXCEL gets an error when the FORTRAN code does the RETURN.&lt;/P&gt;
&lt;P&gt;I could not find a specific answer to this in the list of issues in the forum, so I am hopefull someone can straighten me out.&lt;/P&gt;
&lt;P&gt;Below is the Code I have in my VBA module, the code in the FORTRAN test file, and the output data generated when the program is run, followed by the error I get from EXCEL.&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * EXCEL VBA * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Dim LngYearToRun As Long&lt;/P&gt;
&lt;P&gt;Private Const LngLength1 As Long = 140&lt;/P&gt;
&lt;P&gt;Private Const LngLength2 As Long = 150&lt;/P&gt;
&lt;P&gt;Private Const LngLength3 As Long = 160&lt;/P&gt;
&lt;P&gt;Dim LngValue As Long&lt;/P&gt;
&lt;P&gt;Dim StrUserPath1 As String * 160&lt;/P&gt;
&lt;P&gt;Dim StrUserPath2 As String * 160&lt;/P&gt;
&lt;P&gt;Dim StrUserPath3 As String * 160&lt;/P&gt;
&lt;P&gt;Private Declare Sub DISPATCHDLL Lib "H:\\Visual Studio 2008\\Projects\\Dll1\\Dll1\\Release\\DLL1.dll" (LngYearToRun As Long, ByVal StrUserPath1 As String, LngLength1 As Long, ByVal StrUserPath2 As String, LngLength2 As Long, ByVal StrUserPath3 As String, LngLength3 As Long, LngValue As Long)&lt;/P&gt;
&lt;P&gt;Sub DealemDLLSub()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;LngYearToRun = 2010&lt;/P&gt;
&lt;P&gt;LngValue = 256&lt;/P&gt;
&lt;P&gt;StrUserPath1 = "User Path Name 1"&lt;/P&gt;
&lt;P&gt;StrUserPath2 = "User Path Name 2"&lt;/P&gt;
&lt;P&gt;StrUserPath3 = "User Path Name 3"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Cells(7, 1).Value = "Before Call"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Call DISPATCHDLL(LngYearToRun, StrUserPath1, LngLength1, StrUserPath2, LngLength2, StrUserPath3, LngLength3, LngValue)&lt;/P&gt;
&lt;P&gt;Cells(9, 1) = Time&lt;/P&gt;
&lt;P&gt;Cells(7, 1).Value = "FINISHED"&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;End Sub&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * Program * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Subroutine DispatchDLL(YearToRunIN,Path1,n1,Path2,n2,Path3,n3,n4)&lt;/P&gt;
&lt;P&gt;INTEGER N&lt;/P&gt;
&lt;P&gt;INTEGER N1,N2,N3,N4,N5,N6&lt;/P&gt;
&lt;P&gt;INTEGER ArrayPointer&lt;/P&gt;
&lt;P&gt;INTEGER YearToRunIN, NumUnitsIN, Length&lt;/P&gt;
&lt;P&gt;Character (len=140) Path1&lt;/P&gt;
&lt;P&gt;Character (len=150) Path2&lt;/P&gt;
&lt;P&gt;Character (len=160) Path3&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;!dec$ attributes dllexport :: DispatchDLL&lt;/P&gt;
&lt;P&gt;!dec$ attributes alias : "DISPATCHDLL" :: DispatchDLL&lt;/P&gt;
&lt;P&gt;!dec$ attributes stdcall, REFERENCE :: DispatchDLL&lt;/P&gt;
&lt;P&gt;OPEN(UNIT=999,FILE='H:\\INTEL\\INTEL_errorlog.dat',STATUS='REPLACE',ERR=991)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) 'Before write'&lt;/P&gt;
&lt;P&gt;WRITE (999,*) YearToRunIN&lt;/P&gt;
&lt;P&gt;WRITE (999,*) TRIM(Path1)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N1&lt;/P&gt;
&lt;P&gt;WRITE (999,*) TRIM(Path2)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N2&lt;/P&gt;
&lt;P&gt;WRITE (999,*) TRIM(Path3)&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N3&lt;/P&gt;
&lt;P&gt;WRITE (999,*) N4&lt;/P&gt;
&lt;P&gt;WRITE (999,*) 'After write'&lt;/P&gt;
&lt;P&gt;CLOSE (999)&lt;/P&gt;
&lt;P&gt;RETURN&lt;/P&gt;
&lt;P&gt;991 RETURN&lt;/P&gt;
&lt;P&gt;END&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * INTEL_errorlog.dat * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Before write&lt;/P&gt;
&lt;P&gt;2010&lt;/P&gt;
&lt;P&gt;User Path Name 1&lt;/P&gt;
&lt;P&gt;140&lt;/P&gt;
&lt;P&gt;User Path Name 2&lt;/P&gt;
&lt;P&gt;150&lt;/P&gt;
&lt;P&gt;User Path Name 3&lt;/P&gt;
&lt;P&gt;160&lt;/P&gt;
&lt;P&gt;256&lt;/P&gt;
&lt;P&gt;After write&lt;/P&gt;
&lt;P&gt;* * * * * * * * * * * * EXCEL ERROR * * * * * * * * * * * *&lt;/P&gt;
&lt;P&gt;Microsoft Office Excel has encountered a problem and needs to close. We are sorry for the inconvenience.&lt;/P&gt;
&lt;P&gt;When I click on Debug I get&lt;/P&gt;
&lt;P&gt;An unhandled win32 exception occurred in EXCEL.EXE[2508]&lt;/P&gt;</description>
      <pubDate>Mon, 22 Feb 2010 19:14:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-multiple-string-variables-returning-to-EXCEL-VBA/m-p/886243#M76814</guid>
      <dc:creator>jlgilber</dc:creator>
      <dc:date>2010-02-22T19:14:41Z</dc:date>
    </item>
    <item>
      <title>Problem with multiple string variables returning to EXCEL VBA</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-multiple-string-variables-returning-to-EXCEL-VBA/m-p/886244#M76815</link>
      <description>CVF and IVF have different default conventions for string length passing. If you add MIXED_STR_LEN_ARG to the !DEC$ ATTRIBUTES directive for the routine, that should take care of it.</description>
      <pubDate>Mon, 22 Feb 2010 20:05:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Problem-with-multiple-string-variables-returning-to-EXCEL-VBA/m-p/886244#M76815</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-02-22T20:05:27Z</dc:date>
    </item>
  </channel>
</rss>

