The MASM Forum

Projects => Rarely Used Projects => PowerBASIC => Topic started by: hutch-- on January 26, 2015, 11:55:16 PM

Title: Using an SLL for complete application encapsulation.
Post by: hutch-- on January 26, 2015, 11:55:16 PM
It is usually good practice in library design to put every function into a separate module as this solves the problem of pulling in unused code but this is essentially the consideration that matters when you build a "component" library. There is in fact another use for the SLL capacity built into the current versions of PB, the capacity to encapsulate entire working applications minus their resources into a single SLL.

Recently I posted a Notepad style editor in the PB API subforum so I don't need to post it here but this is what I used as a test piece to show how you can encapsulate and entire complex object into a single file. This is the source code to call the SLL.

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

    #compile exe "txted.exe"
    #RESOURCE "monotxt.pbr"
    #link "monotxt.sll"

' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤




' ¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤¤

In the original source for the text editor there are only 2 mods, changed the PBmain() to the following.


and removed the compiled resource file from the include file as SLLs do not support containing resources.

The exe that calls the SLL does not need header files or any other dependencies, just provide the PBR resource file and the SLL that contains the entire app and it will build directly from the compiler.