Kerad
04-21-2004, 02:16 PM
Hi,
I am currently working on a .Net Project. In this project I have to use some very old thing :D made with Fortran 77.
I have no problem with .Net, as it's my main technologi for more than 2 years, but I never used Fortran :cool:
Well, the problem is, I don't know how to do that :(
So I have the followig questions:
1. Is there a way to convert automaticaly the Fortran 77 code into Fortran.Net code
2. If not, can we encapsulate fortran 77 function into .NEt classes (something with an external definition or what)
3. Or is ther a way to make a DLL with Fortran77 that can be used by .Net
I tried this with the following:
INTEGER FUNCTION dlleas(n)
!MS$ATTRIBUTES DLLEXPORT :: dlleas
dlleas=n*9
END FUNCTION
I exported it to a dll
First thing: the entry generated in the DLL is _DLLEAS@4 :eek:
Never mind, i do the following with C#:
[DllImport(@"C:\developpement\noyeau\dlleas.dll", EntryPoint="_DLLEAS@4")]
[return:MarshalAs(UnmanagedType.I4)]
public static extern int dlleas([MarshalAs(UnmanagedType.I4)]int n);
And then i try to do:
dlleas(3) or dlleas(i) where I is an int. But in both cases I get a System.NullreferenceException at runtime :(
4. Maybe we can make a dll using the fortran77 with the Lahay Compiler... how to to that ?
Well, any help would be welcome ;)
Thanks a lot
Kerad
I am currently working on a .Net Project. In this project I have to use some very old thing :D made with Fortran 77.
I have no problem with .Net, as it's my main technologi for more than 2 years, but I never used Fortran :cool:
Well, the problem is, I don't know how to do that :(
So I have the followig questions:
1. Is there a way to convert automaticaly the Fortran 77 code into Fortran.Net code
2. If not, can we encapsulate fortran 77 function into .NEt classes (something with an external definition or what)
3. Or is ther a way to make a DLL with Fortran77 that can be used by .Net
I tried this with the following:
INTEGER FUNCTION dlleas(n)
!MS$ATTRIBUTES DLLEXPORT :: dlleas
dlleas=n*9
END FUNCTION
I exported it to a dll
First thing: the entry generated in the DLL is _DLLEAS@4 :eek:
Never mind, i do the following with C#:
[DllImport(@"C:\developpement\noyeau\dlleas.dll", EntryPoint="_DLLEAS@4")]
[return:MarshalAs(UnmanagedType.I4)]
public static extern int dlleas([MarshalAs(UnmanagedType.I4)]int n);
And then i try to do:
dlleas(3) or dlleas(i) where I is an int. But in both cases I get a System.NullreferenceException at runtime :(
4. Maybe we can make a dll using the fortran77 with the Lahay Compiler... how to to that ?
Well, any help would be welcome ;)
Thanks a lot
Kerad