User Tools

Site Tools


checking_20if_20a_20library_20is_20installed

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
checking_20if_20a_20library_20is_20installed [2018/03/31 13:19] – external edit 127.0.0.1checking_20if_20a_20library_20is_20installed [2024/01/05 00:22] (current) – external edit 127.0.0.1
Line 1: Line 1:
 =====Checking if a library is INSTALLed===== =====Checking if a library is INSTALLed=====
  
-//by Jon Ripley, January 2006//\\ \\ //BBC BASIC for Windows// provides no built in function to check whether a library has been loaded into memory using the **INSTALL** command. \\ \\  The following routine **FN_IsInstalled(lib$)** implements a method to check if a library is currently **INSTALL**ed:\\ \\ +//by Jon Ripley, January 2006//\\ \\ //BBC BASIC for Windows// provides no built in function to check whether a library has been loaded into memory using the **INSTALL** command. \\ \\  The following routine **FN_IsInstalled(lib$)** implements a method to check if a library is currently **INSTALL**ed:\\ \\ <code bb4w>
         DEF FN_IsInstalled(lib$)         DEF FN_IsInstalled(lib$)
         IF ?HIMEM = 0 THEN = FALSE         IF ?HIMEM = 0 THEN = FALSE
Line 18: Line 18:
           ENDWHILE           ENDWHILE
         UNTIL (!P% AND &FFFFFF) = &FFFF00         UNTIL (!P% AND &FFFFFF) = &FFFF00
-        = FALSE +        = FALSE </code> 
-\\  To check if a library is installed use code similar to the following:\\ \\ +\\  To check if a library is installed use code similar to the following:\\ \\ <code bb4w>
         IF FN_IsInstalled(@lib$+"WINLIB") THEN         IF FN_IsInstalled(@lib$+"WINLIB") THEN
           PRINT "WINLIB is installed."           PRINT "WINLIB is installed."
         ELSE         ELSE
           PRINT "WINLIB is not installed."           PRINT "WINLIB is not installed."
-        ENDIF+        ENDIF </code>
 \\  To list all installed libraries call **FN_IsInstalled("-")**.\\ \\  \\  To list all installed libraries call **FN_IsInstalled("-")**.\\ \\ 
 ===== Installing a library only once ===== ===== Installing a library only once =====
-\\  When you [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin5.html#install|INSTALL]] a library, //BBC BASIC for Windows// checks whether that library is already installed (version 5.91a or later only), however it performs a case-sensitive comparison of the supplied path/filename. It will reliably detect the **same** INSTALL statement being executed a second time, but not necessarily a **different** INSTALL statement which installs the same library but specifies it differently.\\ \\  Installing a library more than once is safe but wastes memory. If this is a concern, the following routine can be used instead of **INSTALL**:\\ \\ +\\  When you [[http://www.bbcbasic.co.uk/bbcwin/manual/bbcwin5.html#install|INSTALL]] a library, //BBC BASIC for Windows// checks whether that library is already installed (version 5.91a or later only), however it performs a case-sensitive comparison of the supplied path/filename. It will reliably detect the **same** INSTALL statement being executed a second time, but not necessarily a **different** INSTALL statement which installs the same library but specifies it differently.\\ \\  Installing a library more than once is safe but wastes memory. If this is a concern, the following routine can be used instead of **INSTALL**:\\ \\ <code bb4w>
         DEF PROC_InstallOnce(lib$)         DEF PROC_InstallOnce(lib$)
         IF NOT FN_IsInstalled(lib$) THEN INSTALL lib$         IF NOT FN_IsInstalled(lib$) THEN INSTALL lib$
-        ENDPROC+        ENDPROC </code>
checking_20if_20a_20library_20is_20installed.1522502349.txt.gz · Last modified: 2024/01/05 00:18 (external edit)