Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
module/library version string?
#1
Trying to implement version string per library.
I don't want to have for each library a separate CONST or SUB/FUNCTION with different name just to get it's version string. 
I also don't want to hardcode the library names and versions in a single place.
DATA / READ / RESTORE doesn't work, because RESTORE doesn't accept a variable.
Any ideas how I could implement this?
Reply
#2
Hi,

Restore need label name, not variable:

Code: (Select All)
For t = 1 To 4
    Restore num_A
    count = 0
    Do Until count = t
        Read NrA
        count = count + 1
    Loop
    Restore num_B

    count = 0
    Do Until count = t
        Read NrB
        count = count + 1
    Loop
    Print "First number is: "; NrA
    Print "Second number is: "; NrB
    Print "First plus second number: "; NrA + NrB
Next

num_A:
Data 5,10,15,20

num_B:
Data 1,2,3,4


Reply
#3
(05-17-2023, 08:11 PM)thesolarcode Wrote: Trying to implement version string per library.
I don't want to have for each library a separate CONST or SUB/FUNCTION with different name just to get it's version string. 
I also don't want to hardcode the library names and versions in a single place.
DATA / READ / RESTORE doesn't work, because RESTORE doesn't accept a variable.
Any ideas how I could implement this?

Here's a solution which I use for my libraries and tools. Although you still need a CONST, FUNCTION or similar (somehow you must define the version strings), you don't need to call each of the FUNCTIONs or examining each CONST just to get all version strings. There's just one FUNCTION SearchVers$(file$), which can examine e.g. the compiled EXE file of your program to identify all version strings in it.

See here: https://qb64phoenix.com/forum/showthread.php?tid=2220
Reply
#4
(05-17-2023, 08:11 PM)thesolarcode Wrote: I don't want to have for each library a separate CONST or SUB/FUNCTION with different name just to get it's version string.

Can you clarify why you don't want to do this? What exactly is the goal?
Reply




Users browsing this thread: 2 Guest(s)