how to call C (non-intel C compiler) from ifort (intel fortran)? - Fortran
This is a discussion on how to call C (non-intel C compiler) from ifort (intel fortran)? - Fortran ; Hi there,
I need to call C within fortran code. I could compile and link using
Visual Fortran
and Visual C++.
Fortran code is like:
..
CALL SUB1(arg1, .......)
..
..
C code is like:
#define sub1 __stdcall SUB1
..
...
-
how to call C (non-intel C compiler) from ifort (intel fortran)?
Hi there,
I need to call C within fortran code. I could compile and link using
Visual Fortran
and Visual C++.
Fortran code is like:
..
CALL SUB1(arg1, .......)
..
..
C code is like:
#define sub1 __stdcall SUB1
..
void sub1 ( arg1, ........)
..
..
Now I have to use another machine with Intel Fortran (ifort) with .NET
(Visual Studio
2005). When I linked, I got error message "unresolved external symbol
_SUB1".
What is the right way to do? (For using ifort with icc, an example is
shown in
http://www.ncsa.uiuc.edu/UserInfo/Re...trancallc.html)
Any help is very much appreciated.
-
Re: how to call C (non-intel C compiler) from ifort (intel fortran)?
ktrchang@gmail.com wrote:
> Hi there,
>
> I need to call C within fortran code. I could compile and link using
> Visual Fortran
> and Visual C++.
>
> What is the right way to do?
There are plenty of examples in the doc directory of your Fortran
installation, including (if you have a current ifort) documents on the
ISO C interoperability scheme of current standard Fortran.
-
Re: how to call C (non-intel C compiler) from ifort (intel fortran)?
ktrchang@gmail.com wrote:
> I need to call C within fortran code. I could compile and link using
> Visual Fortran and Visual C++.
> CALL SUB1(arg1, .......)
> C code is like:
> #define sub1 __stdcall SUB1
> void sub1 ( arg1, ........)
> Now I have to use another machine with Intel Fortran (ifort)
> with .NET (Visual Studio 2005). When I linked, I got error message
> "unresolved external symbol _SUB1".
It is not unusual for Fortran subroutine and function names to
be generated with an extra _ on them. Also, since C is case sensitive
and the routine in the message is upper case change the C routine
name to _SUB1.
#define sub1 __stdcall _SUB1
-- glen
-
Re: how to call C (non-intel C compiler) from ifort (intel fortran)?
ktrchang@gmail.com wrote:
| Hi there,
|
| I need to call C within fortran code. I could compile and link using
| Visual Fortran
| and Visual C++.
|
| Fortran code is like:
| .
| CALL SUB1(arg1, .......)
| .
| .
| C code is like:
| #define sub1 __stdcall SUB1
| .
| void sub1 ( arg1, ........)
| .
| .
| Now I have to use another machine with Intel Fortran (ifort) with .NET
| (Visual Studio
| 2005). When I linked, I got error message "unresolved external symbol
| _SUB1".
| What is the right way to do? (For using ifort with icc, an example is
| shown in
|
http://www.ncsa.uiuc.edu/UserInfo/Re...trancallc.html)
|
| Any help is very much appreciated.
Intel changed the default calling convention from __stdcall to __cdecl,
when it took over the CVF. So, either adjust it on C side, or change the
calling convention on Fortran side. In addition, the way how CHARACTER
arguments are passed is also changed -- the hidden length is now passed
at the end of argument-list rather than immediately following the string
argument.
--
Jugoslav
___________
www.xeffort.com
Please reply to the newsgroup.
You can find my real e-mail on my home page above.
-
Re: how to call C (non-intel C compiler) from ifort (intel fortran)?
On Sep 27, 7:02 pm, ktrch...@gmail.com wrote:
> Hi there,
>
> I need to call C within fortran code. I could compile and link using
> Visual Fortran
> and Visual C++.
>
> Fortran code is like:
> .
> CALL SUB1(arg1, .......)
> .
> .
> C code is like:
> #define sub1 __stdcall SUB1
> .
> void sub1 ( arg1, ........)
> .
> .
> Now I have to use another machine with Intel Fortran (ifort) with .NET
> (Visual Studio
> 2005). When I linked, I got error message "unresolved external symbol
> _SUB1".
> What is the right way to do? (For using ifort with icc, an example is
> shown inhttp://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/Intel64Cluster/D...)
>
> Any help is very much appreciated.
Thank you all for the postings.
In ifort /help, it shows:
/Gm enable CVF and Powerstation calling convention
compatibility
(same as /iface:cvf)
With /Gm, error of unresolved external symbol is resolved.
BTW, I intended to include link below but it was cut off.
http://www.ncsa.uiuc.edu/UserInfo/Re...ntel64Cluster/
Doc/fortrancallc.html
ReggieC
Similar Threads
-
By Application Development in forum Fortran
Replies: 4
Last Post: 12-14-2007, 06:24 PM
-
By Application Development in forum Fortran
Replies: 56
Last Post: 10-19-2007, 02:35 AM
-
By Application Development in forum Fortran
Replies: 0
Last Post: 06-05-2007, 11:07 AM
-
By Application Development in forum Fortran
Replies: 0
Last Post: 04-03-2007, 08:09 AM
-
By Application Development in forum Fortran
Replies: 0
Last Post: 03-25-2007, 06:59 AM