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

Resource Scripts and Libraries

bearoflittlebrain_ol
728 Views

I have a set of home-brewed utilities in a library util.lib, compiled with CVF 6.6B. A couple of the routines use custom dialog boxes contained in a resource script util.rc.

There is no trouble using them in a programeg Prog.exe withoutits own resource script: add util.rc to the Project Resources. But whenit does have its own resource script (and it is allowed only one), I am reduced to opening util.rc in Notepad and copying and pasting to the program's resource file prog.rc.

I feel that I should be using a resource template to expedite matters but cannot see how to do it / don't know if it is possible.

Any comments / assistance etc would be welcome.

Alan

0 Kudos
2 Replies
anthonyrichards
New Contributor III
728 Views

I use CVF 6.6C. It is possible to create a resource-only DLL. You can then allow an EXEcutable to access the resources in the DLL by including code to load the DLL, get a handle to the resource you wantto useand then use things like DLGINITWITHRESOURCEHANDLE . For example:

integer DLLhInstance, lret
character*128 Dialogresource
type (dialog) gdlg

include 'resource.fd'
! The abovefilemust contain definitions of your your resource ID's, like IDD_MY_DIALOG
! which is produced when you create your resource-only DLL.

Dialogresource='MyDialogresource.dll'C
DLLhInstance=LoadLibrary( Dialogresource )

! Initialise the dialog using the resource ID and the resource handle
lret = DlgInitwithresourcehandle(IDD_MY_DIALOG, DLLhInstance, gdlg)

Obvously, your .EXE has to then be accompanied by the DLL and its resource ID definition file, RESOURCE.FD (or whatever name you choose for it). However, to change the resources available, you then just have to rebuild the DLL and the resource.fd file will be automatically updated. As far as I know, this is the only way to make resources available to a DLL.

0 Kudos
bearoflittlebrain_ol
728 Views

Anthony,

Many thanks. I will give it a go.

Alan

0 Kudos
Reply