Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

c_null_ptr missing inside iso_c_binding ?

tilio
Beginner
1,413 Views
I did:

program test
use, intrinsic :: iso_c_binding
implicit none

type(c_ptr) :: it
it=C_NULL_PTR

end program test

gives on compilation:

Undefined symbols:
"_iso_c_binding_mp_c_null_ptr_", referenced from:
_MAIN__ in ifortSi2yr6.o

on MAC OS 10.5.2 with ifort 10.1
0 Kudos
3 Replies
Steven_L_Intel1
Employee
1,413 Views
This is a known problem that is fixed in a future release. I think you can work around it with something like this:

module my_iso_c_binding
use, intrinsic :: iso_c_binding, dummy=>C_NULL_PTR
type(c_ptr) :: C_NULL_PTR
!DEC$ ATTRIBUTES EXTERN,ALIAS:"iso_c_binding_mp_c_null_ptr" :: C_NULL_PTR
end module my_iso_c_binding

program test
use my_iso_c_binding
implicit none

type(c_ptr) :: it
it=C_NULL_PTR

end program test
0 Kudos
tilio
Beginner
1,413 Views
I copy pasted your code but it still doesn't compile:

Undefined symbols:
"iso_c_binding_mp_c_null_ptr", referenced from:
_MAIN__ in ifortFw4qcO.o
ld: symbol(s) not found

0 Kudos
Steven_L_Intel1
Employee
1,413 Views
Oops. Use this instead:

!DEC$ ATTRIBUTES EXTERN,ALIAS:"iso_c_binding_mp_c_null_ptr_" :: C_NULL_PTR

I never can keep the different name decorations straight. The problem is that we fixed a bug in the compiler that left off a leading underscore but missed updating the run-time library.
0 Kudos
Reply