Preventing+a+library+from+being+run

//by Jon Ripley, July 2006, January 2007//

To prevent a library from being run add the following code to the start of the library after any initial comment block to generate a syntax error when a user tries to run your library:

code format="bb4w" ; code

To generate a more descriptive error instead add the following code to the start of your library:

code format="bb4w" SYS "MessageBox", @hwnd%, "This is a library and cannot be run.", 0, 48 QUIT code

The message appears in a message box and the program will quit when it is dismissed. This necessarily adds 78 bytes to the library, even when added to a compiled program, but ensures that the library will not be executed and alerts users that the library is not an executable program.