File in dll resources

File in dll resources

Hi all,

I have a text file that is located in the resources of a dll file built from a Visual Fortran project. In order to read the file at runtime, I have a pointer association between the resource and a local array of characters (lenght = 80) whose size is enough to contain all the lines present in the file (one element = one line). I have noticed that when I get the pointer to the resource, the array is automatically filled with the lines present in the file: i.e. each time a combination of CR+LF is encountered, the line is stored in the array and the index in the array goes automatically to the next element. This is fine for me. However, the same does not run in COMPAQ Visual Fortran except if the local array contain 82 characters (instead of 80, i.e. the CR and LF characters are treated as normal characters). Why does this behaves differently between CVF and IVF ? Is it due to a particular compiler switch that I did not notice ?

Best regards,

Phil.

7 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Sounds like a bug we fixed sometime in the past 10 years.

Steve - Intel Developer Support

Hi Steve,

Thanks for the clarification.
Do you mean that the behavior I get with the Intel compiler is conforming to the standard ?

Best regards,
Phil.

Well, I am not exactly sure what you are doing here. Are you using internal I/O to "read" the data? Can you give a clearer outline (perhaps with sample code) to show what you're doing?

Steve - Intel Developer Support

No, I do not use implicit internal I/O to read the data.
The data are located in a file included in the resources of my dll. When needed, I load the resource, get a pointer to the resource using the LockResource function and because I have a pointer association between the resource pointer and a character array, it is automatically mapped to the resource.
I hope to have been not too confusing, please find attached the related source code.
The involved lines are 153-162 plus the declaration part at lines 30-36.

Best regards,

Phil.

附件: 

附件尺寸
下载 correlationinfo.zip2.25 KB

I would expect that if you are memory mapping a Fortran variable that whatever bytes were in the memory would appear in the variable. If there were CR/LF pairs, those should appear as bytes in the variable as they have no special meaning, and your array would be filled in 80-byte increments. I take back my suggestion of a bug fix - the compiler and its libraries are likely not involved at all. Can you come up with a small, self-contained program I can try for myself?

Steve - Intel Developer Support

This is what I was expecting and this is how it works in CVF. Originaly, all the lines of the file were merged into one with an offset of 80 bytes (i.e. chars). However it is not very comfortable to manage the file, mainly for editing, and because of the possible line breaks that can happen and so corrupt the structure I would prefer to use a standard text file. This is when I have tried, that I noticed the difference in the compiler behaviors. The source code attached previously uses the former approach. Now I have changed my mind and I have written a small utility that reads the contents of the text file and creates the binary file before including it in the resources. Nevertheless, I will try to bring to you a small program that reproduces the behavior.

Thanks again,
Phil.

发表评论

登录添加评论。还不是成员?立即加入