forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Recources
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Sat Mar 28, 2020 10:40 am    Post subject: Recources Reply with quote

Is there any way to place recources not into the executable but e.g. into a DLL?
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Mar 28, 2020 11:24 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Sat Mar 28, 2020 4:18 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Mar 28, 2020 8:04 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Sun Mar 29, 2020 7:57 am    Post subject: Reply with quote

All my software is 64 bit !?
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Mar 29, 2020 9:13 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Sun Mar 29, 2020 10:06 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Mar 29, 2020 2:25 pm    Post subject: Reply with quote

USE_RESOURCE_LIBRARY@ (note the spelling) should be available via USE clrwin or INCLUDE <clearwin.ins>.
Back to top
View user's profile Send private message AIM Address
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Sun Mar 29, 2020 3:03 pm    Post subject: Reply with quote

Yes it is. Sorry, a typing error.
Back to top
View user's profile Send private message Visit poster's website
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Sun Mar 29, 2020 6:17 pm    Post subject: Reply with quote

I have sent you an email
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Mar 30, 2020 9:12 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
EKruck



Joined: 09 Jan 2010
Posts: 224
Location: Aalen, Germany

PostPosted: Mon Mar 30, 2020 9:57 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Mar 30, 2020 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Mon Mar 30, 2020 4:14 pm    Post subject: Reply with quote

Good news. I made a mistake when creating my sample demo and this works as expected.

Please download the demo via the following link...

https://www.dropbox.com/s/phq43gatxmcxos5/ResourceStuff.zip?dl=0
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Wed Apr 01, 2020 11:55 am    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group