PDA

View Full Version : Fortran code from c# with passed complex arrays


dabenPB
05-18-2004, 09:38 PM
Hi

I have a Fortran 70 that I would like to compile to a dll and call from c#. The code has the following input/output within the procedural call:

double x, in byval
complex RefREL, in byval
long nAng, in byval
complex array(1D) sx, in/out byref
double array(1D) Q, in/out byref
long i, in byval

where byref means that I change the value of the variable within the Fortran code and want to access this new value within the c# code.

Is this possible with your Fortran.Net compiler? The most important thing is the complex array -- I think this is where there will be trouble. I currently use the Exocortex.DSP package to handle complex numbers within c#.

thanks
daben

tzeis
05-18-2004, 11:57 PM
The question is a little confusing. If you want to make an unmanaged Win32 dll, you should be able to do that, providing you supply the proper interfaces for the Fortran code to C#. We supply an example of calling a Fortran Win32 dll from C#. If you use our .NET compiler, you can create an assembly (here is where the confusion arises, because this file has a .dll extension, but it is actually managed .NET MSIL) that you can refer to from C#. If the structure that we use for the COMPLEX type is the same as what the other package uses, you should not have any problems. Here is our definition (in Fortran) for COMPLEX:

type :: Complex
sequence
real(kind=4) :: RealPart
real(kind=4) :: ImaginaryPart
end type

If the type definitions do not match, you will have to do a type conversion in the C#.