|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Anonymous Guest
|
Posted: Tue Jan 24, 2006 1:36 pm Post subject: Passing an array of floats from Fortran into .NET |
|
|
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(, 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: 7925 Location: Salford, UK
|
Posted: Wed Jan 25, 2006 1:25 am Post subject: Passing an array of floats from Fortran into .NET |
|
|
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 |
|
|
|
|
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
|