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 an array of floats from Fortran into .NET

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Tue Jan 24, 2006 1:36 pm    Post subject: Passing an array of floats from Fortran into .NET Reply with quote

I am having trouble figuring out how to call a c# program and pass it an array of floating point values from Fortran. I have a fortran subroutine, which is being called from various other fortran subroutines and it needs to pass an array of floats onto a C# function that it will be calling. So far I have only been able to pass arrays to the C# function if I use the object declaration method to declare a new .NET array and then pass that as the function parameters. While I could go back and rewrite all of the fortran code to explicitly use .NET arrays, I would like to avoid that.

As and example of what I am trying to do:

SUBROUTINE fortranfunc (y)
ASSEMBLY_EXTERNAL(NAME="CS_Test.Functions.test") :: TEST
REAL(SP), DIMENSION(Smile, INTENT(IN) :: y

call TEST(y)
.
.
.
END SUBROUTINE

namespace CS_TEST {
public class Functions {
public static void test(ref float[] y) {
.
.
.
}
}
}

And when I try to compile I get the error message: "No .NET method matches this call" on the call TEST(y) line

I am probably missing something simple here, but I have not been able to find it in the documentation.
Back to top
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7924
Location: Salford, UK

PostPosted: Wed Jan 25, 2006 1:25 am    Post subject: Passing an array of floats from Fortran into .NET Reply with quote

Eric

One way to proceed is to use

public static unsafe void test(float* y)

and to set the C# project proterties to accept unsafe code
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support 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