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

mixed language

Rodrigues__Pedro
Beginner
943 Views

 

  Hello

         I always used fortran but now I have to mix two languages(FORTRAN,C). I followed these steps:

        - I made the 'c' code;

        -I used the 'c' compiler to create the object file(.obj);

       - I created a new fortran project;

 My doubt is only this one: how can I say to the compiler inside the IDE, and not in command prompt, to compile with the c object file? Where is that option?

 

    thanks in advance

 

Peter

 

 

 

 

 

 

 

0 Kudos
5 Replies
FortranFan
Honored Contributor III
943 Views

You will need to create a separate project in your solution for your C code.  If you have Fortran main program, you can add a C static library project in your solution, include your C code in that project, and link your Fortran against the lib file generated in the C project.

 

0 Kudos
FortranFan
Honored Contributor III
943 Views

Also, take a look at the Intel Fortran samples for mixed-language programming:

User and Reference Guide for the Intel® Fortran Compiler 14.0

Using the Intel® Fortran Samples

The following applies to Fortran for Microsoft Visual Studio* 2010 and 2008.

The Intel® Fortran Compiler installs a number of sample programs. These programming samples illustrate a variety of concepts such as:

 

  • Creating console applications

  • Creating QuickWin applications

  • Creating Win32 applications

  • Using mixed-language support

  • Using OpenGL* in Fortran applications

 

The programming samples are located in the<install-dir>\Samples\ directory. These samples have associated build files that use the Intel® Fortran Compiler, in command-line mode, to compile and build the Fortran sources.

For further information on the samples and how to use them, use a web browser to open and read the samples.htm document in the \Samples\ folder.

Alos, look at the documentation in "User and Reference Guide for the Intel Fortran Compiler" under Compiler Reference, Mixed Language Programming.

0 Kudos
Rodrigues__Pedro
Beginner
943 Views

Thanks for the answer

   But now I have a new doubt. How can I creat a 'C' static library inside IDE?

0 Kudos
FortranFan
Honored Contributor III
943 Views

P R. wrote:

...

   But now I have a new doubt. How can I creat a 'C' static library inside IDE?

There is an infinite amount of information available online on how to use Visual Studio for various C/C++ projects.  Go through Visual Studio help, consult MSDN (Microsoft site), StackOverflow, CodeProject, etc. and you will find lots of useful links like this one: http://msdn.microsoft.com/en-us/library/vstudio/ms235627(v=vs.110).aspx.  Note on this link the section on "Creating a console app that references the static library" - this can readily apply to your scenario if you have a main project that is written in Fortran.

0 Kudos
Ketson_Roberto
Beginner
943 Views

Hi, P R, you can find some informations over here (http://msdn.microsoft.com/en-us/library/ms235627.aspx), I think that it could be useful for you! It is not difficult to do this...

0 Kudos
Reply