Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

how to change fortran input to C#

ayahamdy
Beginner
876 Views
Dear Sir,
i have library written in Fortran it's input from C library using commands and it's run under windows using cygwin & i want to use this library as dll in my C# code and pass my input instead of c library .... idon't know if i can use GUI instead of this commands or No way ???
Really ineed help A.S.A.P
0 Kudos
6 Replies
onkelhotte
New Contributor II
876 Views
Quoting - ayahamdy
Dear Sir,
i have library written in Fortran it's input from C library using commands and it's run under windows using cygwin & i want to use this library as dll in my C# code and pass my input instead of c library .... idon't know if i can use GUI instead of this commands or No way ???
Really ineed help A.S.A.P

I dont fully understand your question...

You have a C# GUI and you want to pass data to a Fortran DLL? This is possible, only strings and arrays need a little bit more work. Search this forum, there a enough questions and sample code about this. A C# command line application + Fortran DLL should work too.

Markus
0 Kudos
klaus_knebel
Beginner
876 Views
Hi
I tried to mix C# and Fortran too.
But it is not easy or almost impossible, because C# is running only in .NET enviroment and IVF not
so mixing these too seems not to be possible as easy as C++ & IVF.

http://software.intel.com/en-us/forums/showthread.php?t=63394

Klaus
0 Kudos
ArturGuzik
Valued Contributor I
876 Views
Quoting - klaus knebel
Hi
I tried to mix C# and Fortran too.
But it is not easy or almost impossible, because C# is running only in .NET enviroment and IVF not
so mixing these too seems not to be possible as easy as C++ & IVF.

http://software.intel.com/en-us/forums/showthread.php?t=63394

Klaus

Klaus,

everything depends on what you mean by mixing. You can't do it as in CVF, that's true. For .Net you need to "close your Fortran in dll" and use System.Runtime.InteropServices, then DLLImport where you specify/change default calling convention (C for IVF is default). MS calls it "consuming unmanaged code clients".

A.
0 Kudos
klaus_knebel
Beginner
876 Views
yes
this is what I mean when I say mixing.
Having one projekt and using C# for GUI or other things and Fortran for the number crunshing stuff.
We are not able to use IVF DLL or library in a C# Project.
I dont know why.
Klaus


0 Kudos
ArturGuzik
Valued Contributor I
876 Views
Quoting - klaus knebel
yes
this is what I mean when I say mixing.
Having one projekt and using C# for GUI or other things and Fortran for the number crunshing stuff.
We are not able to use IVF DLL or library in a C# Project.
I dont know why.
Klaus

Klaus,

it's strange. What errors do you get? You should be able to do (almost) without a problem. You need System.Runtime.InteropServices. Take a look at this for examples how to call and pass data.

A.
0 Kudos
klaus_knebel
Beginner
876 Views
OK thanks
I will try again
0 Kudos
Reply