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

Problem with Fortran compiler not recognizing routines used previously

ivf_ian
Novice
12,509 Views

Having problems with the Fortran compiler not recognizing certain routines which had been previously used in the program, more specifically, createwindowex. loadicon and loadmenu.  See drop box.  What happened to them and are there other routines one could use instead?   

0 Kudos
1 Solution
danielbrown8998
12,410 Views

The issue happens because CreateWindowEx, LoadIcon, and LoadMenu are Windows API functions, not built-in Fortran routines. If the compiler can’t recognize them, it usually means the Windows API libraries or interfaces are not linked/included.

Possible reasons:

Missing Windows API interface/module.

Required libraries (like user32) are not linked.

Compiler update removed old compatibility modules.

Fix:

Link the user32 library when compiling.

Include the proper Win32 API interface in your Fortran code.

Alternative:
You can also use GUI libraries such as GTK for Fortran instead of calling the Windows API directly.

View solution in original post

0 Kudos
25 Replies
ivf_ian
Novice
1,328 Views

For the record opticsoft.f90 is the main function.

0 Kudos
ivf_ian
Novice
1,241 Views

Shouldn't have stated latest IVF, rather the IVF version a couple of years ago. 

0 Kudos
andrew_4619
Honored Contributor III
1,664 Views

Steve, I also looked, one that perturbed me was:

interface !lib=ifwin.lib
integer(4) function convertFtoCstring(cstring,fstring);
!DEC$ ATTRIBUTES DEFAULT :: convertFtoCstring
!DEC$ IF DEFINED(_M_IX86)
!DEC$ ATTRIBUTES STDCALL, ALIAS : '_convertFtoCstring@8' :: convertFtoCstring
!DEC$ ELSE
!DEC$ ATTRIBUTES STDCALL, ALIAS :  'convertFtoCstring'   :: convertFtoCstring
!DEC$ ENDIF
!DEC$ ATTRIBUTES REFERENCE::cstring
character *(*)  cstring
integer       fstring 
end function convertFtoCstring
end interface

Which is in IFWBASE.f90 in his code this routine is called with (in effect) loc(fortran string). I am guessing this worked in 32 bit  which suggests to me that this interface is probably bad but not seeing any documentation  then who knows?

0 Kudos
Steve_Lionel
Honored Contributor III
1,412 Views

Yes, that "integer fstring" is certainly suspicious. TBH, I had never run across this routine before - like the rest of IFWBASE its origins are Microsoft Fortran PowerStation. The name of the function is confusing, as it is being used to copy a C string from an OPENFILENAMEA structure to a local character variable (a Fortran string).  None of the provided Windows API samples use it.

In any case, I agree with you that the interface is bad. It would not be difficult to come up with a function written in Fortran to replace it. If I were doing this, I'd add a "rename" to USE IFWBASE to hide the bad interface, for example:

use ifwbase, donotuse => ConvertFtoCstring

then I would declare my own function by that name.

0 Kudos
witwald
New Contributor II
1,353 Views

@ivf_ian Is that collection of Optisoft files complete? Can you tell me which file contains the main program? I couldn't find it...

Reply