- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
the character array'slength is 87 whichcan be obtained in Fortran code correctly. I then use a char array with length 1024 to get the value of the passed array, but it failed on X64. I'm using VS2005 and IVF9.1 on a 2Quad cpu with x64 system(windows server)to build x64 program.Here is some related code in fortran and error msg:
character*1024 test
iz=len(filename) !iz is 87 in my try
iz1=iz-4 ! iz1 is 83 here
test=filename(1:iz1)//char(0) ! error here.
Error msg: forrtl: severe(408):fort:(4):Variable filename has substring ending point 83 which is greater than the variable length of 87. I changed iz1 to ann other integer and it still failed with the same msg, "x is greater than 87".
I saw another thread like this in previous posts, but I don't know how or whether it has been resolved.
Thanks very much.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks very much. I use "long" integer so it should be ok in 64 bit system. Here is a demo of C++ code:
extern "C"
{ void _stdcall function1( char* filename1, long size1);
}
long size2=strlen(filename1)
function1(filename1,size2);
in function1() of fortran code, variable filename1 is defined as
Char*(*) filename1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks very much. I use "long" integer so it should be ok in 64 bit system. Here is a demo of C++ code:
extern "C"
{ void _stdcall function1( char* filename1, long size1);
}
long size2=strlen(filename1)
function1(filename1,size2);
in function1() of fortran code, variable filename1 is defined as
Char*(*) filename1
My VS2005 C++ compiler documentation reckons a long is a only a 32 bit quantity in 64 bit mode. Have a look at the article in the VS 2005 Help titled "Common Visual C++ 64-bit Migration Issues".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My VS2005 C++ compiler documentation reckons a long is a only a 32 bit quantity in 64 bit mode. Have a look at the article in the VS 2005 Help titled "Common Visual C++ 64-bit Migration Issues".
ifort has supported iso_c_binding for close to a year now. As there is commonality between ICL and MSVC on the relevant issues, this has to work between ifort and either ICL or MSVC. Thus, you don't need non-portable data types or C-Fortran interface to make this work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, thanks very much. You are right.I tried using DWORD64 to define the length and it's ok for X64 program.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page