Intel Fortran V7.1 - Mixing Fortran (Modules) and C

Intel Fortran V7.1 - Mixing Fortran (Modules) and C

Dear All,

I have a question/problem related the using of Fortran Modules and C ++ code using Intel Fortran V7.1.
Unfortunately I'm not able to link the code, which I guess is because I can't figure out the correct naming conventient of subroutines in the modules.
Here is an example (for code see end of this message), which is illustrating the problem. The code is linking without any problems, when I change to V8.0

For v7.1 I use the following compiler commands:
ifc -c test.f90
icpc -c main.cpp
ifc test.o main.o

for v8.0
ifc -c test.f90
icpc -c main.cpp
ifc -nofor_main test.o main.o

Wenn I use nm to look at the object files I get:

V8.0:
-----
U for_write_seq_lis
00000000 T mymod_
00000004 C mymod_mp_a_
00000002 T mymod_mp_b_
00000000 r STRLITPACK_0

=> so here I can see, that mymod_mp_b_ is the correct name, but for V7.1 I get ...

V7.1
-----
00000028 d EPC.RZERO.0
00000004 C MODULE.mymod_0.a
U f_iod
00000000 T mymod..b_
00000000 d mymod..b_IOTABLES.25

How do I call mymod..b_ from within a C++ program. Is there anyway to change this?
Unfortunately I couldn't find any information concerning the use of modules in the documentation and also the document which describes the difference between V8 and V7.1 only mentiones the -nofor_main switch.

Btw. If I change mymod..b_ manually to mymod__b_ and replaces the function call inside the c++ program, it actually works ;-)

Any help would be greatly appreaciated.
Best Regards,
Tobias

test.f90:
--------------
MODULE mymod
INTEGER a
CONTAINS
SUBROUTINE b (j)
INTEGER j
print *, j
END SUBROUTINE
END MODULE

main.cpp:
--------------
extern "C" {
void mymod_mp_b_(int *test);
}

int main() {
int i = 8;
mymod_mp_b_(&i);
}

1 Beitrag / 0 neu
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.