<?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 You need to use ByVal for the in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956819#M93660</link>
    <description>&lt;P&gt;You need to use ByVal for the strings on the VB side. You also need to either make sure that the VB passed string length matches what you declare on the Fortran side, or pass the length separately.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2013 16:29:37 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2013-07-22T16:29:37Z</dc:date>
    <item>
      <title>Calling Fortran subroutine dll  from VB.NET 2010</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956817#M93658</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;VB.NET&lt;/P&gt;
&lt;P&gt;Public Declare Auto Sub MyDll Lib "MyDll.dll"&amp;nbsp;(ByRef STR_IN As String, ByRef DBL_OUT As String)&lt;/P&gt;
&lt;P&gt;Dim str as String="Praveen"&lt;/P&gt;
&lt;P&gt;Dim str1 as String&lt;/P&gt;
&lt;P&gt;Call MyDll(str,str1)&lt;/P&gt;
&lt;P&gt;Fortran&lt;/P&gt;
&lt;P&gt;subroutine MyDll(STRING_IN, DBL_OUT,strl)&lt;BR /&gt; IMPLICIT NONE&lt;BR /&gt; !DEC$ ATTRIBUTES DLLEXPORT::MyDll&lt;BR /&gt; !DEC$ ATTRIBUTES STDCALL,ALIAS:'MyDll' :: MyDll&lt;BR /&gt; CHARACTER(10), INTENT(IN) :: STRING_IN&lt;BR /&gt;!DEC$ ATTRIBUTES REFERENCE :: STRING_IN&lt;BR /&gt; CHARACTER(10), INTENT(OUT) :: DBL_OUT&lt;BR /&gt; DBL_OUT=STRING_IN // " A"&lt;BR /&gt; RETURN&lt;BR /&gt; end subroutine MyDll&lt;/P&gt;
&lt;P&gt;The above code is not working and I am getting system violation exception...&lt;/P&gt;
&lt;P&gt;Any Help Plz............&lt;/P&gt;
&lt;P&gt;Praveen&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 16:14:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956817#M93658</guid>
      <dc:creator>Praveen_D_1</dc:creator>
      <dc:date>2013-07-22T16:14:58Z</dc:date>
    </item>
    <item>
      <title>This is the correct</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956818#M93659</link>
      <description>&lt;P&gt;This is the correct subroutine&lt;/P&gt;
&lt;P&gt;subroutine MyDll(STRING_IN, DBL_OUT)&lt;BR /&gt;IMPLICIT NONE&lt;BR /&gt;!DEC$ ATTRIBUTES DLLEXPORT::MyDll&lt;BR /&gt;!DEC$ ATTRIBUTES STDCALL,ALIAS:'MyDll' :: MyDll&lt;BR /&gt;CHARACTER(10), INTENT(IN) :: STRING_IN&lt;BR /&gt;!DEC$ ATTRIBUTES REFERENCE :: STRING_IN&lt;BR /&gt;CHARACTER(10), INTENT(OUT) :: DBL_OUT&lt;BR /&gt;DBL_OUT=STRING_IN // " A"&lt;BR /&gt;RETURN&lt;BR /&gt;end subroutine MyDll&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 16:17:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956818#M93659</guid>
      <dc:creator>Praveen_D_1</dc:creator>
      <dc:date>2013-07-22T16:17:38Z</dc:date>
    </item>
    <item>
      <title>You need to use ByVal for the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956819#M93660</link>
      <description>&lt;P&gt;You need to use ByVal for the strings on the VB side. You also need to either make sure that the VB passed string length matches what you declare on the Fortran side, or pass the length separately.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 16:29:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956819#M93660</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-07-22T16:29:37Z</dc:date>
    </item>
    <item>
      <title>Edited Code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956820#M93661</link>
      <description>&lt;P&gt;Edited Code&lt;/P&gt;
&lt;P&gt;FORTRAN:&lt;/P&gt;
&lt;P&gt;subroutine MyDll(STRING_IN, DBL_OUT,STR_LEN)&lt;BR /&gt; IMPLICIT NONE&lt;BR /&gt; !DEC$ ATTRIBUTES DLLEXPORT::MyDll&lt;BR /&gt; !DEC$ ATTRIBUTES STDCALL,ALIAS:'MyDll' :: MyDll&lt;BR /&gt; INTEGER*4, INTENT(IN) :: STR_LEN&lt;BR /&gt; CHARACTER(LEN=STR_LEN), INTENT(IN) :: STRING_IN&lt;BR /&gt; CHARACTER(LEN=STR_LEN), INTENT(OUT) :: DBL_OUT&lt;BR /&gt; !DEC$ ATTRIBUTES REFERENCE :: STRING_IN,DBL_OUT&lt;BR /&gt; DBL_OUT="helllo"&lt;BR /&gt; RETURN&lt;BR /&gt; end subroutine MyDll&lt;/P&gt;
&lt;P&gt;VB.NET:&lt;/P&gt;
&lt;P&gt;Public Declare Auto Sub MyDll Lib "MyDll.dll" _&lt;BR /&gt; (ByVal STR_IN As String, ByVal DBL_OUT As String, ByVal STR_LEN As Integer)&lt;/P&gt;
&lt;P&gt;Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click&lt;BR /&gt; Try&lt;BR /&gt; Debug.Print("started")&lt;BR /&gt; Dim str As String = "Praveen"&lt;BR /&gt; Dim str1 As New String("@", 7)&lt;BR /&gt; Call MyDll(str, str1, str.Length)&lt;/P&gt;
&lt;P&gt;Debug.Print(str1)&lt;BR /&gt; Debug.Print("completed")&lt;BR /&gt; Catch ex As Exception&lt;BR /&gt; Debug.Print(ex.ToString)&lt;BR /&gt; End Try&lt;BR /&gt; End Sub&lt;/P&gt;
&lt;P&gt;OUTPUT:&lt;/P&gt;
&lt;P&gt;started&lt;BR /&gt;敨汬潬† @@&lt;BR /&gt;completed&lt;/P&gt;
&lt;P&gt;What's wrong in the code? Help me Plzzzzzzzzzzz&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 19:41:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956820#M93661</guid>
      <dc:creator>Praveen_D_1</dc:creator>
      <dc:date>2013-07-22T19:41:16Z</dc:date>
    </item>
    <item>
      <title>It looks as if VB has changed</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956821#M93662</link>
      <description>&lt;P&gt;It looks as if VB has changed considerably since the VB-Calls-Fortran sample was written. In testing your program, as well as the sample, I see that contrary to the sample comments, VB does NOT send a NUL-terminated character string. In fact it sends a UNICODE string that Fortran won't be able to deal with directly. You'd need to use the various UNICODE conversion procedures in module IFNLS.&lt;/P&gt;
&lt;P&gt;I suggest that you look at the sample VB.NET-Safearrays for some examples of this. In the meantime, we need to redo the VB-Calls-Fortran sample.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 20:20:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956821#M93662</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2013-07-22T20:20:03Z</dc:date>
    </item>
    <item>
      <title>I ran across this thread</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956822#M93663</link>
      <description>&lt;P&gt;I ran across this thread while doing a related search, and I happened&lt;BR /&gt;
	to find a solution...&lt;/P&gt;

&lt;P&gt;VB sent unicode characters to the fortran dll because of the "auto"&lt;BR /&gt;
	character set modifier in the Declare statement. Simply removing the&lt;BR /&gt;
	word "auto" from the Declare statement allows the program to work&lt;BR /&gt;
	properly.&amp;nbsp; Or, changing "auto" to "ansi" (which is the default) also works.&lt;/P&gt;

&lt;P&gt;-- Curtis&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 15 Dec 2013 22:36:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Calling-Fortran-subroutine-dll-from-VB-NET-2010/m-p/956822#M93663</guid>
      <dc:creator>Curtis_Haase</dc:creator>
      <dc:date>2013-12-15T22:36:30Z</dc:date>
    </item>
  </channel>
</rss>

