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

Passing arguments from C to Fortran ( iteratively) Urgent!!

rampy
Beginner
210 Views
Hi,



I am using Microsoft Visual C++ and Intel Fortran Compiler , both integrated in Microsoft Visual Basic.If I want to pass some arguments from C to Fortran , what are the commands which should be used for compiling it at command prompt. I am able to pass arguments from Fortran to C and compile at command prompt by creating a .obj file in C and linking it with Fortran at command promt.







Basically , I have a fortran program and a C program . Now some arguments are passed from Fortran to C and manipulated in C and returned back to Fortran for further calculation . How can I do this automatically, since C will be called at new time step iteratively. I saw some messages of creating .dll file .But have no clue how it works.







P.S . I am new to mixed level programming so if anyone can give some examples and commands of running it, it will be of great help.







Thanks in advance



Rampy..

Message Edited by rampy on 03-24-200612:19 PM

Message Edited by rampy on 03-24-200612:19 PM

0 Kudos
1 Reply
Steven_L_Intel1
Employee
210 Views
You don't need a DLL, but.. you say you have "a C program". Is this actually a self-contained program or is it a subroutine? It's easy to call a C subroutine from Fortran (and vice-versa). Assuming your C code is in a subroutine (or function), build like this:

cl /c csub.c
ifort fortmain.f90 csub.obj

This will build fortmain.exe
0 Kudos
Reply