Компилить в одну программу fortran и С код, это как делается?

vertyal17

Compiling Fortran 95/90 and C Source Files
The following ifort command compiles the free-format Fortran main program myprog.f90., which references the module TYPEDEFS_1 with a USE TYPEDEFS_1 statement (it uses the object file created in the previous example). The module file typedefs_1.mod is read from the current directory. The main program calls a function written in C. The C routine named utilityx_ is declared in a file named utilityx.c:
ifort myprog.f90 typedefs_1.o utilityx.c
ifort does not recognize a source file with a .c extension as needing to be compiled by the C compiler. Instead, it passes it as an "unknown" to the linker. You will need to call the C compiler to compile utilityx.c.

Это работает?
Если да, то какия объявления надо сделать в .f90 чтобы она поняла что такаято функция будет взята из .c , и что писать в .c файле, просто тело функции?
Написано, что ifort не компилит .с, а его надо откомпилировать отдельно. Ну скажем я его скомпилирую и получу .obj, потом надо будет просто их вместе слинковать и все?

vertyal17

Все еще интересно

durka82

У Бартеньева в книгах это описано.

vertyal17

Эх как заботаю !
Оставить комментарий
Имя или ник:
Комментарий: