- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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

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