- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently, in Linux and Mac versions of Intel Fortran, one can just include c code into the "make" files for the project. And it gets automatically compiled.
Is there anyway to do something similar in Windows from the IDE approach?
Linda
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1. In the Fortran library project, set Libraries > Disable default library search rules to No.
2. Make sure the Fortran and C projects have the same setting for run-time libraries (under Code Generation in C)
3. Add the path to the Intel Fortran run-time libraries LIB folder to Tools > Options > Projects > VC++ Directories > Library Files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The procedure described is equivalent to writing a makefile script but VS obviates having to do so. Who wants to blend your own curry powder?VS.NET is designed to facilitate mixed-language programming within a solution, including native C/C+. Too bad for the Mac Linux folks.
Gerry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
main project (exe) is fortran.
static library does not seem to be an option for c projects. do i make a "net" class library?
i'm using VS 2003
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm not at that computer right now but I think there were only two options:
Win32 project
Win32 console application
under Win32
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In VS 2005/8 it's under CLR. BTW, a Makefile project is under General.
Gerry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
no CLR grouping appears in VS2003. At least that I see.
i do see the makefile project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for taking the time to look, Steve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for those hints -- they allowed me to make static libraries out of the c code and include the libraries into the Fortran project (rather than including in the solution space). And I think that was the way to go for my project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's precisely what VS of any vintage does for you.This also applies toVS 98 for CVF which creates the illusion that you can have c and Fortran in the same project. The clearest way to see this is to compile, (load), and link from the command line. Most peoplesoon get fed up doing this, overcome whatever mental block they have in usingthe premierIDE on the market (aka VS, the one that puts the video in ifort), andsoon wonder how they survived without it. For all its warts, the jewel in the crown (sic debugger) sure beats littering code with print's and write's and with successive releases shines on like a crazy diamond.
Steve, any estimate ofthe %-age of IVF users that forgo VS in favor of the command line?
Gerry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Speaking for my group of 10 or so developers that would be 0%. We'd rather have an IDE than try to compile the 200 odd files from the command line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear All,
I have almost similar problem as Linda. I spent the whole weekend to make my code compile without much luck. My main code is in FORTRAN with several subroutines. Some of those routines call a few more C routines. These work in LINUX ifort using Makefile. I am a new user of IVF (Microsoft Visual Studio 2008). This is what I have done:
Created a Project -> Intel Fortran -> Console Application -> (named the project)
Right click on the project name: Add -> Existing Item -> (Added all fortran codes)
Right click on the project name: Add -> New Project ->Visual C++ -> Win32 -> Win32 Project -> (named) -> (next) -> Application Settings -> Static Library -> (finish)
Followed the steps suggested by Steve:
1. In the Fortran library project, set Libraries > Disable default library search rules to No. (It was default)
2. Make sure the Fortran and C projects have the same setting for run-time libraries (under Code Generation in C) (Done. I have Multithread DLL (/libs:dll /threads) in fortran and Multi-threaded DLL (/MD) in C)
3. Add the path to the Intel Fortran run-time libraries LIB folder to Tools > Options > Projects > VC++ Directories > Library Files
I have given C:soluDebug, where I have Object File Library (single file) for all the C codes.
When I compile the C codes separately, they do compile. When I compile the whole project, the fortran codes cannot locate the C routines.
I must have misunderstood something.
I have tried many different things. Latest I have added C:soluDebug in the Linker under the Project Properties. This is the message I get while linking:
Linking...
1>ipo: error #11021: OBJREAD Error: Could not create mapping for C:soluccodeDebug
1>Link: error error_during_IPO_compilation: problem during multi-file optimization compilation (code 1)
Please help!
MA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is what I found the easiest for me:
1) Keep my fortran project.
2) make a new project (don't add to solution) for the c codes.
Make the c compile into a Library (option off Win32 project when you get to "application settings")
3) after the c code is compiled into a library, just add it (as an existing file) to the fortran project.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Linda,
Is there anything I need to change in the Project Properties? I have added separately generated C library, "ccode.lib" for my case, in the fortran Project/Solution, but I still get the same errors:
1>Linking...
1>diskout.obj : error LNK2019: unresolved external symbol _DATAOUT referenced in function _DISKOUT
1>parseinput.obj : error LNK2019: unresolved external symbol _GETKEY referenced in function _PARSEINPUT
1>parseinput.obj : error LNK2019: unresolved external symbol _GETSTR referenced in function _PARSEINPUT
1>parseinput.obj : error LNK2019: unresolved external symbol _GETREAL referenced in function _PARSEINPUT
1>parseinput.obj : error LNK2019: unresolved external symbol _GETINT referenced in function _PARSEINPUT
1>parseinput.obj : error LNK2019: unresolved external symbol _GETSTRN referenced in function _PARSEINPUT
1>meshgen.obj : error LNK2019: unresolved external symbol _DATAIN referenced in function _READX
1>diskin.obj : error LNK2001: unresolved external symbol _DATAIN
1>Debugsolu.exe : fatal error LNK1120: 7 unresolved externals
What else am I missing? Advance thanks!
MA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may need to add something like this to your fortran routines/module that call the c routines:
MODULE ISO_C_FUNCTION_BINDING
USE, INTRINSIC :: ISO_C_BINDING
END MODULE ISO_C_FUNCTION_BINDING
MODULE FortranRoutinestoCallC
INTERFACE
INTEGER(C_INT) FUNCTION SQLiteOpenDatabase (dbNameBuffer, dbNameLength) BIND (C, NAME="SQLiteOpenDatabase")
USE ISO_C_FUNCTION_BINDING
IMPLICIT NONE
TYPE(C_PTR), VALUE :: dbNameBuffer
INTEGER(C_INT), VALUE :: dbNameLength
END FUNCTION SQLiteOpenDatabase
INTEGER(C_INT) FUNCTION SQLiteExecuteCommand (commandBuffer, commandLength) BIND (C, NAME="SQLiteExecuteCommand")
USE ISO_C_FUNCTION_BINDING
IMPLICIT NONE
TYPE(C_PTR), VALUE :: commandBuffer
INTEGER(C_INT), VALUE :: commandLength
END FUNCTION SQLiteExecuteCommand
END
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'll look into it. Thanks.
In the meantime, has anybody else have anyother suggestions? Since the code runs as is in Linux, there must be a way to make it work without changing it much. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I didn't see the sample project mentioned above, apologies if I missed it. You may find it useful to compare your setup with the sample:
C:Program Files (x86)IntelCompilerFortran10.1.019samplesMixedLanguageFortran_Calls_C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The sample code looks good and should lead me to a solution. Thanks guys.
However, for now my Boss wants me touse Linux :(
...Just one more question:what does theBYTESWAP8 do in C? Is it converting ASCII to Binary? Can it doBinary to ASCII as well, or there is another function?
Thanks! MA

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page