- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use the c_ptr and c_loc of the iso_c_binding module, but a compilation errer is reported: "undefined reference to `iso_c_binding_mp_c_loc_'" The compile commands I ues are: ifort -c sub.f90 icc -c main.c icc main.o sub.o And here follows my code.
module try_ptr contains subroutine test() bind(c) use iso_c_binding,only : c_loc,c_ptr,c_int implicit none type(c_ptr) :: mptr integer(c_int) :: mj(10) mptr=c_loc(mj(1)) return end subroutine test end module try_ptr
#include <stdio.h> int main() { printf("test\n"); }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try:
icc -c main.c
ifort -nofor_main sub.f90 main.o
See description of option '-nofor_main' in compiler guide: It will make sure, the Fortran run time libraries are linked in while expecting the main program not being implemented in your Fortran code. This is the structure of your application
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try:
icc -c main.c
ifort -nofor_main sub.f90 main.o
See description of option '-nofor_main' in compiler guide: It will make sure, the Fortran run time libraries are linked in while expecting the main program not being implemented in your Fortran code. This is the structure of your application
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This works out, thanks.
HeinzB (Intel) wrote:
Try:
icc -c main.c
ifort -nofor_main sub.f90 main.o
See description of option '-nofor_main' in compiler guide: It will make sure, the Fortran run time libraries are linked in while expecting the main program not being implemented in your Fortran code. This is the structure of your application
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page