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

QuickWin runtime library and accessing Stdout

alrheis__ghassan
Beginner
721 Views

Hey,

I am currently debugging a Fortran project compiled using ifort. For one of my tests I am trying to use different runtime libraries to see what issues I will run into. After compiling with the QuickWin runtime library (/libs:qwin) I get an access violation error. I compiled the program again with /traceback and a couple other options and now I think the error happens when attempting to write something to the console which I also think is (or at least should be) the standard output. The line at which the error occurs is the first encouter of "Write(*,*) ..." in the program.

According to what I understood from this, QuickWin applications don't have a "stdout". Someone else that works on this code compiles it with this runtime library and runs it without any issues. I am curious about the possible reasons and would like to know what can they be doing differently to have the code run this way? Also if the code doesn't use any of the graphics features provided by QuickWin is there another reason to compile using this runtime library?

Also, since using different runtime libraries might be the main cause of the errors that I am trying to figure out, is there any good starting point to understanding what the different runtime libraries available to Intel Fortran do? Any leads will help.

I realize that some of the questions  might be hard to answer given the amount of information that I am providing, but I interested in your general opinion.

 

Software and system information:

  • Compiler: Intel fortran compiler 19.0 update 1 for the Visual Studio 2017 environment.
  • My OS is:  64 bit Windows 10 Enterprise version 10.0.17134 Build 17134.
  • My processor is: Intel Core i7-7800X @ 3.50GHz with 12 Logical Processors

 

Regards,

Ghassan

0 Kudos
1 Solution
Steve_Lionel
Honored Contributor III
721 Views

How do you select QuickWin - did you just change the library type and nothing else? If so, you also need to change Linker > System > Subsystem to Windows. This gets done automatically if you create a new project of type QuickWin.

View solution in original post

0 Kudos
6 Replies
Steve_Lionel
Honored Contributor III
721 Views

QuickWin gives a traditional (console) Fortran program a "Windows look and feel". Standard input and output are a window that can be scrolled, with copy/paste, text can be colored, the window frame has menus, multiple windows can be added and graphics drawn, menus can be added and changed. It isn't a full-blown API for windowing applications, but it can do a lot without diving into the Windows API. Uniquely, the Fortran I/O system understands QuickWin, which is not something you can get with any other graphical library. On the other hand, it hasn't changed much in 20 years, and limits you to a statically-linked executable (can't use QuickWin from a DLL.)

Why you should get an access violation on a WRITE, I don't know. The only thing that comes to mind is that, because a QuickWin window is a bitmap, if the window size (including scrolled-off region) is very large, the bitmap may be too big to handle. The first thing I would suggest is to get the actual EXE your colleague runs successfully and try it on your system to see what happens. What happens before that WRITE?

If you don't need the additional features of QuickWin, then there's no point in using it.

 

0 Kudos
alrheis__ghassan
Beginner
721 Views

Thanks for your reply!

Before the Write, an input file is read. I thought that isn't very interesting since Write prints a constant string to the console. 

I ran their .exe, as per your suggestion, and their's spawns a window in which the console appears (as shown in pic_1 in the attachments). While mine is just the console directly (shown in pic_2). Their's doesn't throw the access violation error so I assume I am building it wrong. As far as I can tell, both of them are compiled with the same compiler options. Any idea what I am missing?  

 

Regards,

Ghassan

0 Kudos
Steve_Lionel
Honored Contributor III
722 Views

How do you select QuickWin - did you just change the library type and nothing else? If so, you also need to change Linker > System > Subsystem to Windows. This gets done automatically if you create a new project of type QuickWin.

0 Kudos
alrheis__ghassan
Beginner
721 Views

Hey!

When I do this I don't get an access violation anymore and the program runs fine. Thanks a lot for the help and insight.

 

Regards,

Ghassan

0 Kudos
Steve_Lionel
Honored Contributor III
721 Views

Glad to hear it. What can help when you see that build A works and build B doesn't, for the same source, is to compare project settings for both compile and link. A shortcut for this is to go to the Command Line property page for each of Fortran and Linker and see what is different.

0 Kudos
alrheis__ghassan
Beginner
721 Views

I completely forgot about the linker options. Hopefully won't next time. Thanks again for the tip!

 

Regards,

Ghassan

0 Kudos
Reply