<?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: VC++&amp;Fortran mixed-language string problem in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859472#M68582</link>
    <description>While my linux installation opens this archive automatically, when I am not on my office network which blocks them, of course there are no tools for reading the Microsoft special files.&lt;BR /&gt;I would point out that the short sample first posted seems to indicate that the different string termination requirements of the languages are being ignored, unless the DEC$ directives somehow cover this. If you feel that it is necessary to depend on those specific features, rather than standard Fortran, when using C#, my interest declines sharply.&lt;BR /&gt;Among the advertised features of C# are relatively easy debugging, so you should be able to step the C# code after returning from Fortran to see if you have in fact programmed a buffer over-run. &lt;BR /&gt;As pointed out in recent examples, you can handle null character string termination explicitly in Fortran. The case may also make the point of defensive C programmers about using the strn functions to guard against over-runs.&lt;BR /&gt;</description>
    <pubDate>Mon, 28 Jan 2008 14:05:40 GMT</pubDate>
    <dc:creator>TimP</dc:creator>
    <dc:date>2008-01-28T14:05:40Z</dc:date>
    <item>
      <title>VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859470#M68580</link>
      <description>&lt;P&gt;I posted an early thread this morning, using the C#&amp;amp;Fortran.&lt;/P&gt;
&lt;P&gt;But no one give me even a single answer, so I switch to VC++&amp;amp;Fortran(DLL).&lt;/P&gt;
&lt;P&gt;But I encounter the same problem:Unhandled exception at 0x10001082 in MFCMainTest.exe: 0xC0000005: Access violation reading location 0x00000007.&lt;/P&gt;
&lt;P&gt;Then I switch to so I switch to VC++&amp;amp;Fortran(Static library),then I got another problem:Error1error LNK2019: unresolved external symbol &lt;A href="mailto:_TEST@12"&gt;_TEST@12&lt;/A&gt; referenced in function _dynamicLIBSTRING_Cbridge.obj&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;I put the whole code in the attachment, I hope some guys can get me out of here.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2008 04:49:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859470#M68580</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-28T04:49:23Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859471#M68581</link>
      <description>&lt;P&gt;I's like to try and help, but I do not have the application needed to read your archived file.&lt;/P&gt;
&lt;P&gt;Why noy post it as simple text - It cannot be that large a file surely?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2008 09:54:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859471#M68581</guid>
      <dc:creator>anthonyrichards</dc:creator>
      <dc:date>2008-01-28T09:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859472#M68582</link>
      <description>While my linux installation opens this archive automatically, when I am not on my office network which blocks them, of course there are no tools for reading the Microsoft special files.&lt;BR /&gt;I would point out that the short sample first posted seems to indicate that the different string termination requirements of the languages are being ignored, unless the DEC$ directives somehow cover this. If you feel that it is necessary to depend on those specific features, rather than standard Fortran, when using C#, my interest declines sharply.&lt;BR /&gt;Among the advertised features of C# are relatively easy debugging, so you should be able to step the C# code after returning from Fortran to see if you have in fact programmed a buffer over-run. &lt;BR /&gt;As pointed out in recent examples, you can handle null character string termination explicitly in Fortran. The case may also make the point of defensive C programmers about using the strn functions to guard against over-runs.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Jan 2008 14:05:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859472#M68582</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2008-01-28T14:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859473#M68583</link>
      <description>&lt;P&gt;I thought that theremay besome problems with the project settings, so I put all the solution in one single winrar file. &lt;/P&gt;
&lt;P&gt;Thanks for your reply.&lt;/P&gt;
&lt;P&gt;________________________________________________&lt;/P&gt;
&lt;P&gt;1.Dynamic library&lt;/P&gt;
&lt;P&gt;________________________________________________&lt;/P&gt;
&lt;P&gt;Fortran:&lt;/P&gt;
&lt;P&gt;! dynamiclib.f90 &lt;BR /&gt;!&lt;BR /&gt;! FUNCTIONS/SUBROUTINES exported from dynamiclib.dll:&lt;BR /&gt;! dynamiclib - subroutine &lt;BR /&gt;!&lt;/P&gt;
&lt;P&gt;SUBROUTINE dynamicLIBSTRING(DATA_FILE,Error,Message)&lt;/P&gt;
&lt;P&gt; !DEC$ ATTRIBUTES DLLEXPORT::DYNAMICLIBSTRING&lt;BR /&gt; !DEC$ ATTRIBUTES ALIAS:"dynamicLIBSTRING"::DYNAMICLIBSTRING&lt;BR /&gt; CHARACTER*(*) DATA_FILE&lt;BR /&gt; CHARACTER*(*) Message&lt;BR /&gt; integer:: Error&lt;BR /&gt; OPEN(12,FILE=DATA_FILE,FORM='FORMATTED',MODE='WRITE') &lt;BR /&gt; WRITE(12,*) Error&lt;BR /&gt; WRITE(12,*) DATA_FILE&lt;BR /&gt; WRITE(12,*) Message&lt;BR /&gt; CLOSE(12)&lt;BR /&gt;END SUBROUTINE&lt;/P&gt;
&lt;P&gt;__________________________&lt;/P&gt;
&lt;P&gt;bridge.h&lt;/P&gt;&lt;PRE&gt;#include "stdafx.h"&lt;BR /&gt;#include &lt;WINDOWS.H&gt;&lt;BR /&gt;typedef void (__stdcall *dynamicLIBSTRING)(char * name,int len,int* errnum,char * msg,int len1);&lt;/WINDOWS.H&gt;&lt;/PRE&gt;&lt;PRE&gt;#ifdef __cplusplus&lt;BR /&gt;extern "C" {&lt;BR /&gt;#endif&lt;BR /&gt;_declspec(dllexport) void dynamicLIBSTRING_C(char * name,int len,int errnum,char * msg,int len1);&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;}&lt;BR /&gt;#endif&lt;/PRE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;P&gt;__________________________&lt;/P&gt;&lt;P&gt;bridge.cpp&lt;/P&gt;&lt;P&gt;#include "stdafx.h"&lt;BR /&gt;#include "bridge.h"&lt;/P&gt;&lt;P&gt;extern "C" _declspec(dllexport) void dynamicLIBSTRING_C(char * name,int len,int errnum,char * msg,int len1)&lt;BR /&gt;{&lt;BR /&gt;HINSTANCE hDLL;&lt;BR /&gt;dynamicLIBSTRING dynamicLIBSTRING1;&lt;BR /&gt;hDLL=LoadLibrary(TEXT("dynamiclib.dll"));&lt;BR /&gt;dynamicLIBSTRING1=(dynamicLIBSTRING)GetProcAddress(hDLL,("dynamicLIBSTRING"));&lt;BR /&gt;dynamicLIBSTRING1(name,len,&amp;amp;errnum,msg,len1);&lt;BR /&gt;FreeLibrary(hDLL); &lt;BR /&gt;}&lt;/P&gt;&lt;/PRE&gt;
&lt;P&gt;__________________________&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;MFCMainTestDlg.cpp&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;void CMFCMainTestDlg::OnBnClickedOk()&lt;BR /&gt;{&lt;BR /&gt;// TODO: Add your control notification handler code here&lt;BR /&gt;char* name;&lt;BR /&gt;name = "123.bdg";&lt;BR /&gt;int len = strlen(name);&lt;BR /&gt;int errnum = 0;&lt;BR /&gt;char* msg;&lt;BR /&gt;msg = "";&lt;BR /&gt;int len1 = strlen(msg);&lt;BR /&gt;dynamicLIBSTRING_C(name,len,errnum,msg,len1);&lt;BR /&gt;OnOK();&lt;BR /&gt;}&lt;/PRE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;P&gt;________________________________________________&lt;/P&gt;&lt;P&gt;2.static library&lt;/P&gt;&lt;P&gt;________________________________________________&lt;/P&gt;&lt;P&gt;Fortran:&lt;/P&gt;&lt;P&gt;subroutine TEST(x,y,z)&lt;BR /&gt; real*8:: z&lt;BR /&gt; open(10,file='alpha.out',form='formatted',status='UNKNOWN') &lt;BR /&gt; write(10,'("staticlib:")')&lt;BR /&gt; write(10,'(2F10.2)') x,y&lt;BR /&gt; z = 10&lt;BR /&gt; write(10,'("staticlib1:")')&lt;BR /&gt; write(10,'(F10.2)') z&lt;BR /&gt; z = x+y&lt;BR /&gt; write(10,'("staticlib2:")')&lt;BR /&gt; write(10,'(F10.2)') z&lt;BR /&gt;end subroutine TEST&lt;/P&gt;&lt;P&gt;__________________________&lt;/P&gt;&lt;P&gt;bridge.h&lt;/P&gt;&lt;PRE&gt;#include "stdafx.h"&lt;BR /&gt;#include &lt;WINDOWS.H&gt;&lt;/WINDOWS.H&gt;&lt;/PRE&gt;&lt;PRE&gt;#ifdef __cplusplus&lt;BR /&gt;extern "C" {&lt;BR /&gt;#endif&lt;BR /&gt;void __stdcall TE
ST(float *x,float*y,float*z);&lt;BR /&gt;#ifdef __cplusplus&lt;BR /&gt;}&lt;BR /&gt;#endif&lt;/PRE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;P&gt;__________________________&lt;/P&gt;&lt;P&gt;bridge.cpp&lt;/P&gt;&lt;P&gt;#include "stdafx.h"&lt;BR /&gt;#include "bridge.h"&lt;/P&gt;&lt;P&gt;extern "C" _declspec(dllexport) void dynamicLIBSTRING_C(char * name,int len,int errnum,char * msg,int len1)&lt;BR /&gt;{&lt;BR /&gt;float x = 10;&lt;BR /&gt;float y = 10;&lt;BR /&gt;float z = 10;&lt;BR /&gt;TEST(&amp;amp;x,&amp;amp;y,&amp;amp;z);&lt;BR /&gt;}&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;__________________________&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New"&gt;MFCMainTestDlg.cpp&lt;/FONT&gt;&lt;/P&gt;&lt;PRE&gt;void CMFCMainTestDlg::OnBnClickedOk()&lt;BR /&gt;{&lt;BR /&gt;// TODO: Add your control notification handler code here&lt;BR /&gt;char* name;&lt;BR /&gt;name = "123.bdg";&lt;BR /&gt;int len = strlen(name);&lt;BR /&gt;int errnum = 0;&lt;BR /&gt;char* msg;&lt;BR /&gt;msg = "";&lt;BR /&gt;int len1 = strlen(msg);&lt;BR /&gt;dynamicLIBSTRING_C(name,len,errnum,msg,len1);&lt;BR /&gt;OnOK();&lt;BR /&gt;}&lt;/PRE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jan 2008 14:14:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859473#M68583</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-28T14:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859474#M68584</link>
      <description>&lt;P&gt;Thanks tim.&lt;/P&gt;
&lt;P&gt;My computer justbreakdown today, so I have to rebind the system rightnow. It may take a little time to have VS 2005 &amp;amp; Fortran to be ready. So I can't try your advice rightnow.&lt;/P&gt;
&lt;P&gt;You mentioned that "As pointed out in recent examples, you can handle null character string termination explicitly in Fortran", please let me know how to treat character *(*) type with null character string termination.&lt;/P&gt;
&lt;P&gt;I think "null character string termination " is the problem, do you think 'decorate directive' make any sense? And the problem I encounter is related to "ANSI&amp;amp;unicode"?&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2008 20:35:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859474#M68584</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-28T20:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859475#M68585</link>
      <description>&lt;P&gt;The static library is quite simple, why the C++ compiler give me the error "unresolved external symbol &lt;A href="mailto:_TEST@12"&gt;&lt;FONT color="#0860a8"&gt;_TEST@12&lt;/FONT&gt;&lt;/A&gt; referenced in function ", God, please save me.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2008 20:45:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859475#M68585</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-28T20:45:29Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859476#M68586</link>
      <description>Fortran is expecting the character length to be passed in as "hidden" arguments at the end of the list. You can give the arguments the REFERENCE attribute in Fortran to have it not assume that, but then you'll have to use the INDEX function to find the trailing NUL and get the length. There is no option to have Fortran automatically look for the NUL.&lt;BR /&gt;&lt;BR /&gt;In the C code, take out &lt;BR /&gt;&lt;BR /&gt;_stdcall&lt;BR /&gt;&lt;BR /&gt;That is causing the link error.&lt;BR /&gt;</description>
      <pubDate>Mon, 28 Jan 2008 21:00:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859476#M68586</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-01-28T21:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859477#M68587</link>
      <description>&lt;P&gt;Thanks Steve.&lt;/P&gt;
&lt;P&gt;Didyou mean I have to use the reference directive? I have no idea of the Index function, would you please give some tips.&lt;/P&gt;
&lt;P&gt;BTW, I have found this site:http://www.nag.co.uk/numeric/FL/flassocinfo/csharp/g02eafe.cs&lt;/P&gt;
&lt;P&gt;in which he can use the arguments in this way: "string mean, int length_mean,string weight, int length_weight,ref int n, ref int m". So I think there may be some kind of setting can automatically look for the NULL. I want to hear your point.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2008 23:40:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859477#M68587</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-28T23:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859478#M68588</link>
      <description>I think the reference you found is telling you to have the C code pass the lengths separately. That works too if you make sure to put them at the end of the argument list.&lt;BR /&gt;&lt;BR /&gt;I meant to use:&lt;BR /&gt;&lt;BR /&gt;!DEC$ ATTRIBUTES REFERENCE :: varname&lt;BR /&gt;&lt;BR /&gt;in the Fortran code. This tells the compiler to not look for the passed lengths.&lt;BR /&gt;&lt;BR /&gt;To use INDEX, do something like this:&lt;BR /&gt;&lt;BR /&gt;integer strinng_len&lt;BR /&gt;...&lt;BR /&gt;string_len = index (string_var, CHAR(0))&lt;BR /&gt;&lt;BR /&gt;Now you can reference string_var(1:string_len)&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2008 01:15:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859478#M68588</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-01-29T01:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859479#M68589</link>
      <description>&lt;P&gt;Thanks Steve.&lt;/P&gt;
&lt;P&gt;I use the same way as the reference, but didn't work, why? what's your "That works too if you make sure to put them at the end of the argument list." exactly mean?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2008 03:58:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859479#M68589</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-29T03:58:59Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859480#M68590</link>
      <description>BTW, Steve, why I have to give upthe "stdcall" directive?</description>
      <pubDate>Tue, 29 Jan 2008 09:03:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859480#M68590</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-29T09:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859481#M68591</link>
      <description>Intel Visual Fortran defaults to the C calling convention. If you try calling an IVF routine with __stdcall, the C++ compiler will use the STDCALL convention which changes the external name and uses the stack a different way. Mixing these two leads to linking errors and/or stack corruption.&lt;BR /&gt;&lt;BR /&gt;I suggest that you study the C_calls_Fortran sample provided with the product. It demonstrates passing strings.&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2008 15:14:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859481#M68591</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-01-29T15:14:01Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859482#M68592</link>
      <description>&lt;P&gt;Thanks Steve.&lt;/P&gt;
&lt;P&gt;Where can I find the C_calls_Fortran sample, I have been looking around for a lot of times, but can't find. &lt;/P&gt;
&lt;P&gt;Myfortran is the evaluation version 9.1 downloaded from this site.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2008 15:42:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859482#M68592</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-01-29T15:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859483#M68593</link>
      <description>The samples are new in version 10. 10.1 is the current version. I would think that an evaluation version of 9.1 expired its license a long time ago.&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2008 18:05:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859483#M68593</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-01-29T18:05:12Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859484#M68594</link>
      <description>&lt;P&gt;Thanks,Steve.&lt;/P&gt;
&lt;P&gt;I've already fixed my problem with the help of the sample code, the main factor is that the string length argument have to put after all the argument.&lt;/P&gt;
&lt;P&gt;And I've also figure out how to connect between C# and Fortran. But I found a newly problem, I can't step into the Fortran code from the C# graphic interface, I have searched around this forum, andcheck "Enable unmanaged code debugging" box ,but still not work, I attach the simple code in the attachment, will youplease figure out the problem?&lt;/P&gt;</description>
      <pubDate>Sat, 02 Feb 2008 09:03:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859484#M68594</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-02-02T09:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859485#M68595</link>
      <description>It may be a while before I can try this, but I generally set breakpoints in my Fortran routines - I don't think trying to "step into" is going to work here.&lt;BR /&gt;</description>
      <pubDate>Sat, 02 Feb 2008 23:47:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859485#M68595</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-02-02T23:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859486#M68596</link>
      <description>&lt;P&gt;Set the FORTRAN project as Startup instead of C# project and set break point anywhere in the FORTRAN soubroutine. This should work.&lt;/P&gt;
&lt;P&gt;If you put a breakpoint in the FORTRAN routine, even if the startup project is C# one, it should stop at there. But Stepping in to the function from C# code doesnt work.&lt;/P&gt;</description>
      <pubDate>Sun, 03 Feb 2008 02:42:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859486#M68596</guid>
      <dc:creator>sumi714</dc:creator>
      <dc:date>2008-02-03T02:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859487#M68597</link>
      <description>Thanks, steve. The breakpoints is great.</description>
      <pubDate>Sun, 03 Feb 2008 05:47:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859487#M68597</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-02-03T05:47:58Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859488#M68598</link>
      <description>Thanks Sumi, I don't know why, but the break point satisfy me, that's enough.</description>
      <pubDate>Sun, 03 Feb 2008 05:49:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859488#M68598</guid>
      <dc:creator>owenkid</dc:creator>
      <dc:date>2008-02-03T05:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: VC++&amp;Fortran mixed-language string problem</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859489#M68599</link>
      <description>&lt;P&gt;I have similar problem and that is why I got interested to look at your project. But mine is slightly different, as I am trying to pass a string from C++ code and then change it inside FORTRAN routine and carry back the changed string out of FORTRAN routine.&lt;/P&gt;
&lt;P&gt;I have to use CVF (/iface:cvf) calling convention and set "String Length Argument Passing" as "After Individual String Argument". FORTRAN code is as follows&lt;/P&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;IGET_NS_X.for&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;SUBROUTINE&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; GetFortranMsg(iMsgID,iChar,szMsg)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT color="#008000" size="2"&gt;!MS$ATTRIBUTES c,alias: '_GetFortranMsg'::GetFortranMsg &lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;INCLUDE&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; 'bbb_X.fi' &lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;CHARACTER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;,&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;POINTER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;:: szMsg&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;INTEGER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;,&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;POINTER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;:: iMsgID&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;INTEGER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;,&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;POINTER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;:: iChar&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;CHARACTER&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; szCopyMsg*260&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;szCopyMsg = "It is the string inside FORTRAN code."//&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;char&lt;/FONT&gt;&lt;FONT size="2"&gt;(0)&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;szMsg = szCopyMsg&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;RETURN&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT color="#ff0000" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;END&lt;/FONT&gt;&lt;/B&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;HR /&gt;

&lt;P&gt;&lt;/P&gt;
&lt;P&gt;C++code is as follows:&lt;/P&gt;
&lt;P&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;Engine.cpp&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;extern&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#000000" size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#800000" size="2"&gt;"C"&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;void&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; GetFortranMsg(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt;* iMsgID,&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;int&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt;*ichar,&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;char&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;* szMsg, size_t length_arg);&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;...&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;void&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt; CEngine::PrintMessage()&lt;/STRONG&gt;&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/P&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;int&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt; iMsgID = 1;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff" size="2"&gt;char&lt;/FONT&gt;&lt;FONT size="2"&gt; *szMsg = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;new&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;char&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;[256];&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;STRONG&gt;int&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt; ichar=10;&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;lstrcpy(szMsg,&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#800000" size="2"&gt;&lt;STRONG&gt;"This string has been assigned in C++ code."&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;STRONG&gt;int&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt; l = strlen(szMsg);&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;GetFortranMsg(&amp;amp;iMsgID,&amp;amp;ichar,szMsg,l);&lt;/STRONG&gt;&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;AfxMessageBox(szMsg);&lt;/STRONG&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;STRONG&gt;(szMsg)&lt;/STRONG&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#0000ff" size="2"&gt;delete&lt;/FONT&gt;&lt;FONT size="2"&gt; [] szMsg;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;STRONG&gt;
&lt;HR /&gt;
&lt;/STRONG&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000" size="3"&gt;With above code, I always get the first character of szMsg in FORTRAN code and hence any change made in there would only modify the first character. I have checked the samples provided in IVF 10 and that also behaves in the same way if CVF calling convention is set. Is there any way out other than looping over all along the string length and fetch one character at a time from FORTRAN code.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;</description>
      <pubDate>Sun, 03 Feb 2008 18:54:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/VC-Fortran-mixed-language-string-problem/m-p/859489#M68599</guid>
      <dc:creator>sumi714</dc:creator>
      <dc:date>2008-02-03T18:54:39Z</dc:date>
    </item>
  </channel>
</rss>

