forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passing arrays of strings from C# to FTN95 .NET

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    forums.silverfrost.com Forum Index -> KBase
View previous topic :: View next topic  
Author Message
silverfrost
Site Admin


Joined: 29 Nov 2006
Posts: 169
Location: Manchester

PostPosted: Sun Sep 05, 2004 7:04 pm    Post subject: Passing arrays of strings from C# to FTN95 .NET Reply with quote

An array of .NET strings can be passed from C# to FTN95 .NET routine. This string array can then be copied to a fortran character string array one by one. The following code is an example of this:

Code:

subroutine test (a, a_size, a_elem_length)
string a(0Smile
integer a_size, a_elem_length
character(a_elem_length) b(a_size)
assembly_interface(name="test")
do i=1,a_size
b(i) = a(i-1) ! copy the .NET strings to a fortran character string array, one element at a time
end do
end


The above fortran subroutine could be called from C# with the following code (where test_interface is the name of the DLL/MDL containing the fortran subroutine).

Code:

string[] s = new string[3];
s[0] = "aaaaa";
s[1] = "bbbbb";
s[2] = "ccccc";
test_interface.test(s, 3, 5);
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    forums.silverfrost.com Forum Index -> KBase All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group