- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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..
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
cl /c csub.c
ifort fortmain.f90 csub.obj
This will build fortmain.exe
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page