Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28988 Discussions

Visual Studio 2010 and KIND=C_INT64_T error

breitenfeld
Beginner
753 Views

I'm using visual studio 2010, Visual Fortran Compiler XE 12.0.4.196 [Intel(R) 64], Windows 7_64 and I have a snippet of a module:

MODULE test

  USE, INTRINSIC :: ISO_C_BINDING

  IMPLICIT NONE

  TYPE, BIND(C) :: tmp
     INTEGER(c_int64_t) :: tmp2
  END TYPE mesg_t

And I get the error message:

error #6684: This is an incorrect value for a kind type parameter in this context. [C_INT64_T]
Does this mean that C_INT64_T is not defined (.i.e. a negative kind). How do I pass to C an INT64_T type from Fortran in a portable way in Windows using the Intel compiler without the need to write a separate code to find the equivalent integer KIND in fortran? I have no problems in linux.

 Thanks.

0 Kudos
5 Replies
Steven_L_Intel1
Employee
753 Views
The current version does define C_INT64_T on Windows. It's possible that 12.0.4 didn't - I will check in the morning. The definitions differ by platform depending on what the then-current "corresponding" C compiler supported.
0 Kudos
Steven_L_Intel1
Employee
753 Views
Sorry for not getting to this yesterday. Indeed, compiler version 12.0 defined C_INT64_T as -2 because older versions of VS didn't support stdint.h. We added support for those kinds in compiler version 12.1 (Composer XE 2011 SP1).
0 Kudos
breitenfeld
Beginner
753 Views
Thanks Steve, I'll add a test at build time to see if C_INT64_T is defined, but it's good to know what version it was first supported in.
0 Kudos
Steven_L_Intel1
Employee
753 Views
It is defined, but defined as -2 because "the C processor does not define the corresponding C type".
0 Kudos
breitenfeld
Beginner
753 Views
Sorry, I meant: check to see if it is a valid KIND.
0 Kudos
Reply