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

FORTRAN calling C# DLL - Examples please

David_Caruthers
Beginner
1,068 Views
I am mainly a classoc VMS FORTRAN programmer that can write some C# and othe languages. Recently ported a large engineering/estimating system for VMS FORTRAN to Intel VIsual FORTRAN. THis works but has problems with internal datatable maintenace. The mandate is to replace the table routines with database lookup using C# database access routines.

Are there any good examples of using the Intel Visual FORTRAN Module Wizard to access C# dll. I would appreciate a fair amount of detail. Also none of the people here know how to setup C# to work with the module wizard. Help!

I have used a work around where I spawn a C# program that goes to the database retrieves the data and leaves a file for the FORTRAN but this is a little to slow when a large number of queries are to be done.

Are there good examples of using the module wizard or something else to go directly to a SQL Server databas from IVF?

Thank in advance.

David
0 Kudos
5 Replies
anthonyrichards
New Contributor III
1,068 Views
Here's how one poster handled the passing of character strings between C# and Fortran and vice-versa:

http://software.intel.com/en-us/articles/handling-character-strings-between-c-and-fortran/#comment-36878

If you do web searches, you should be able to find stuff to help you with arrays of variables etc.
Equivalent data types can be found here:

http://software.intel.com/en-us/articles/equivalent-data-types-between-fortran-and-c_sharp/
0 Kudos
David_Caruthers
Beginner
1,068 Views
Thank you for the help but the call is going in the wrong direction. It is the FORTRAN routine that will be doing the calling. I am having difficulty writing any routines in C# and making them callable from FORTRAN. The FORTRAN is driving so to speak.

Thanks,

David
0 Kudos
anthonyrichards
New Contributor III
1,068 Views
A recent thread here (http://software.intel.com/en-us/forums/showthread.php?t=78835&o=a&s=lr) showed how Fortran could call VB .NET by first making a VB .NET Class Library DLL containing the methods (functions) that you want the Fortran to call and making the DLL COM-visible. Then you make a Type library from the DLL and then use the Fortran Module Wizard on the Type library to generate the COM calls to the Class library methods exposed via COM. That way should work for C# as it also is object-oriented like VB .NET.
0 Kudos
Arjen_Markus
Honored Contributor II
1,068 Views
We use a C++ layer in between the Fortran program and the C# subroutines/functions. I do not know the details, unfortunately, but that seems to work fine. (No time now to look them up ;))

Regards,

Arjen
0 Kudos
Jugoslav_Dujic
Valued Contributor II
1,068 Views
Quoting arjenmarkus
We use a C++ layer in between the Fortran program and the C# subroutines/functions. I do not know the details, unfortunately, but that seems to work fine. (No time now to look them up ;))

Us too. Here's an example, with a complete solution:

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

0 Kudos
Reply