- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I recently posted some code for a console program that compiled and linked using Compaq Visual Fortran and I have been trying to get it to do the same using IVF but failing. Here is the code:
program changeconsoleicon
use dfwin
implicit none
INTERFACE
FUNCTION SetConsoleIcon(hIcon)
USE DFWINTY
INTEGER(DWORD) hIcon
!DEC$ ATTRIBUTES DEFAULT, STDCALL, ALIAS:'SetConsoleIcon' :: SetConsoleIcon
END FUNCTION
END INTERFACE
include 'resource.fd'
integer hmodule, hmainicon
integer lret
hModule=GetModuleHandle(0)
hMainIcon = LoadIcon( hModule, MAKEINTRESOURCE( IDI_ICON1 ))
lret=SetConsoleIcon(hMainIcon)
print *, 'Hello World'
pause
end program changeconsoleicon
It fails with "unresolved external symbol SetConsoleIcon referenced in _MAIN__.
Now, I know that SetConsoleIcon exists as an exported symbol in Kernel32.dll (using DUMPBIN /exports on it), so how can I ensure that a standard WINDOWS library such as Kernel32.dll is searched during the link process and any symbol exported from it is found? Under Properties, Fortran..libraries I have tried 'debug multithreaded' and debug multithreaded Dll' with no success. I have also specified 'use common windows libraries - Yes' but the symbol is still not found during linking. What can I do? I thought that IVF would seemlesly find and search through all the Windows libraries as a matter of course and find any symbol that is properly specified and matches with a valid Windows function/subroutine. Help!
P.S. How do I ensure that DEFTOFD.EXE is run automatically after I make changes to a resource script so that RESOURCE.FD is re-created each time?
program changeconsoleicon
use dfwin
implicit none
INTERFACE
FUNCTION SetConsoleIcon(hIcon)
USE DFWINTY
INTEGER(DWORD) hIcon
!DEC$ ATTRIBUTES DEFAULT, STDCALL, ALIAS:'SetConsoleIcon' :: SetConsoleIcon
END FUNCTION
END INTERFACE
include 'resource.fd'
integer hmodule, hmainicon
integer lret
hModule=GetModuleHandle(0)
hMainIcon = LoadIcon( hModule, MAKEINTRESOURCE( IDI_ICON1 ))
lret=SetConsoleIcon(hMainIcon)
print *, 'Hello World'
pause
end program changeconsoleicon
It fails with "unresolved external symbol SetConsoleIcon referenced in _MAIN__.
Now, I know that SetConsoleIcon exists as an exported symbol in Kernel32.dll (using DUMPBIN /exports on it), so how can I ensure that a standard WINDOWS library such as Kernel32.dll is searched during the link process and any symbol exported from it is found? Under Properties, Fortran..libraries I have tried 'debug multithreaded' and debug multithreaded Dll' with no success. I have also specified 'use common windows libraries - Yes' but the symbol is still not found during linking. What can I do? I thought that IVF would seemlesly find and search through all the Windows libraries as a matter of course and find any symbol that is properly specified and matches with a valid Windows function/subroutine. Help!
P.S. How do I ensure that DEFTOFD.EXE is run automatically after I make changes to a resource script so that RESOURCE.FD is re-created each time?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You forgot the DECORATE attribute. I find it difficult to believe that this exact code worked in CVF.
For DEFTOFD, you need to create a custom build step for resource.h as described in the Fortran Building Applications volume - search for "deftofd".
For DEFTOFD, you need to create a custom build step for resource.h as described in the Fortran Building Applications volume - search for "deftofd".
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page