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

@<nn> suffix when the argument has character strings

fjimenem
Beginner
571 Views
I'm using the Intel compiler with the /Gm switch in order to rebuild a legacy code that worked with CVF and that combines C and Fortran modules.

When compiling this C code

__fortran MYCFUNC (inp1, inp2)
int *inp1;
char *inp2;

I get a reference of MYFUNCT@8 in the object; but if I compile my Fortran code

...
INTEGER INP1
CHARACTER(*) INP2
CALL MYCFUNC(INP1, INP2)
...

The object has built in a reference to MYFUNC@12. So, I can't link. It seems like if one compiler assigns a size of 8 to the string variable and one a size of 4. If I change the definition of INP2 to an INTEGER, the reference is made to MYFUNC@8 and the linking is possible, but this is not what I wanted.

Any solution / hint? Thanks in advance
0 Kudos
1 Reply
Steven_L_Intel1
Employee
571 Views
CHARACTER arguments are passed and accepted by Fortran code as two arguments, address and length. This happens in both CVF and Intel Fortran, so you must have had some way of working around this in CVF.

The easiest thing to do is to add an argument to the C function following the character argument of type int - you can choose to ignore it, but it does contain the length of the string passed.

Steve
0 Kudos
Reply