View previous topic :: View next topic |
Author |
Message |
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sat Mar 28, 2020 10:40 am Post subject: Recources |
|
|
Is there any way to place recources not into the executable but e.g. into a DLL? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Sat Mar 28, 2020 11:24 am Post subject: |
|
|
The subroutine use_resource_library@ allows you to use resources in a DLL.
For example the file mydll.f95 say:
Code: | SUBROUTINE test()
use clrwin
call use_resource_library@("mydll.dll")
iw = winio@("%ca[Bitmap]&")
iw = winio@("%bm[mybitmap]")
END SUBROUTINE
|
Resources are placed in a resource script res.rc say:
Code: |
mybitmap BITMAP chimp.bmp
|
The main program is say main.f95:
Code: | PROGRAM main
call test()
END
|
Compile mydll.f95 and main.f95 using FTN95. Compile res.rc using SRC.
Link mydll.obj and res.obj (for 32 bits) into a DLL. Link main.obj into the exe. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sat Mar 28, 2020 4:18 pm Post subject: |
|
|
Paul,
I had
Code: |
APP_ICON ICON ic_adplo.ico
DOTS3 BITMAP bt_3dots.bmp
BT_Draw BITMAP bt_Draw.bmp
bt_OK BITMAP bt_OK.bmp
bt_PngFileL BITMAP bt_PngFileL.bmp
bt_Exit BITMAP bt_ExitS.bmp
|
and
Code: | !$ AdploMain
!------------------------------------------------------------------
WINAPP !!! '..\icons\rc_Adplo.rc'
PROGRAM AdploMain ! Start program for ADPLO functions
! REV. 2019-AUG-01 Copyright: Dr. Erwin Kruck, Aalen, Germany, 1987 - 2019
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
USE GlobalData
USE AdploData
USE GrafFiles
IMPLICIT NONE
INCLUDE <clearwin.ins>
INCLUDE <win32api.ins>
INTEGER iRet
CHARACTER cString*8
INTEGER, EXTERNAL :: cb_SavePara, cb_ReadPara, AdploGUI, AdploDraw, cb_ReadCameraData
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- - - - - - - - - -
CALL rc$adplo ()
TaskName = 'ADPLO'
cGaphicFileName = 'Adplo_Graph_00'
iWindowHandle = 0
|
and created
Code: | SUBROUTINE rc$adplo ()
USE CLRWIN
IMPLICIT NONE
INTEGER MA
CALL USE_RECOURCE_LIBRARY@ ('BgoRes.DLL')
MA= WINIO@ ('%ca[ICON]&')
MA= WINIO@ ('%bm[APP_ICON]&')
MA= WINIO@ ('%ca[BITMAP]&')
MA= WINIO@ ('%bm[DOTS3]&')
MA= WINIO@ ('%bm[BT_Draw]&')
MA= WINIO@ ('%bm[bt_OK]&')
MA= WINIO@ ('%bm[bt_PngFileL]&')
MA= WINIO@ ('%bm[bt_Exit]')
RETURN
END SUBROUTINE rc$adplo
|
and
Code: | DLL
LOAD rc$adplo.obj
EXPORTALL
FILE D:\Bingo\bin\BgoResources.dll
|
But the program do not start with message, that app_icon is not available |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Sat Mar 28, 2020 8:04 pm Post subject: |
|
|
You should compile the resource script using SRC. If the script is resource.rc then for 32 bits the output is resource.obj.
Then LOAD resource.obj with the other obj file when running SLINK. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sun Mar 29, 2020 7:57 am Post subject: |
|
|
All my software is 64 bit !? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Sun Mar 29, 2020 9:13 am Post subject: |
|
|
OK. The only difference is that you must use /r when compiling with SRC. The result is a .res file resource.res say. Then you load resource.res with the DLL obj64 file when linking and createing the DLL with SLINK64. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sun Mar 29, 2020 10:06 am Post subject: |
|
|
File MakeResourceDLL.bat:
Code: | FTN95 rc$adplo.f90 /no_banner /64 /opt /MOD_PATH ..\Moduls
src /r rc_adplo.rc
SLINK64 @BgoRecources.lk
|
File BgoRecources.lk:
Code: | DLL
LOAD rc$adplo.obj
LOAD RC_ADPLO.RES
EXPORTALL
FILE D:\Bingo\bin\BgoResources.dll
|
Result:
Code: | D:\Bgo_7.2\IconsDLL>MakeResourceDLL
D:\Bgo_7.2\IconsDLL>FTN95 rc$adplo.f90 /no_banner /64 /opt /MOD_PATH ..\Moduls
D:\Bgo_7.2\IconsDLL>src /r rc_adplo.rc
[Silverfrost SRC/WIN32 Ver 4.20 Copyright (c) Silverfrost Ltd 2018]
D:\Bgo_7.2\IconsDLL>SLINK64 @BGORecources.lk
[SLINK64 v2.04, Copyright (c) Silverfrost Ltd. 2015-2018]
Loading D:\Bgo_7.2\IconsDLL\rc$adplo.obj
Loading D:\Bgo_7.2\IconsDLL\RC_ADPLO.RES
Creating dynamic link library D:\Bingo\bin\BgoResources.dll
The following symbols were not defined:
USE_RECOURCE_LIBRARY@
D:\Bgo_7.2\IconsDLL>
|
Where to find USE_RECOURCE_LIBRARY@ ? |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Sun Mar 29, 2020 2:25 pm Post subject: |
|
|
USE_RESOURCE_LIBRARY@ (note the spelling) should be available via USE clrwin or INCLUDE <clearwin.ins>. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sun Mar 29, 2020 3:03 pm Post subject: |
|
|
Yes it is. Sorry, a typing error. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Sun Mar 29, 2020 6:17 pm Post subject: |
|
|
I have sent you an email |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Mon Mar 30, 2020 9:12 am Post subject: |
|
|
I am very sorry for this error but it now appears that use_resource_library@ is not working as it should for 64 bit DLLs.
At the moment I am assuming that it is a SLINK64 issue and I have referred it to the author.
Unfortunately I am not able to provide a work around. |
|
Back to top |
|
|
EKruck
Joined: 09 Jan 2010 Posts: 224 Location: Aalen, Germany
|
Posted: Mon Mar 30, 2020 9:57 am Post subject: |
|
|
Is there a Windows API behind which I could use instead?
Background: To protect my software against illegal copies I use a CodeMeter dongle from WIBU. Every executable will be put into an envelope and can be encrypted only using the dongle. It seems, that the WIBU software has a bug which has had not any effect since years. But since Windows 10 Version 1909 the resources inside my executables are not found anymore - my software does not work!
My idea was to put all resources into a file (DLL) which will not be protected with a WIBU envelope to get my software working again. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Mon Mar 30, 2020 10:47 am Post subject: |
|
|
I don't have anything to offer at the moment except the hope that we can get a fix soon from the author of SLINK64, then I will be able to send you a new SLINK64. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7932 Location: Salford, UK
|
Posted: Wed Apr 01, 2020 11:55 am Post subject: |
|
|
The call to use_resource_library@ has been made redundant for the next release of ClearWin+.
ClearWin+ will automatically look for resources in the executable and in any attached DLLs that were created using FTN95 or SCC.
The above download and sample will in future not need the call to use_resource_library@. |
|
Back to top |
|
|
|