Announcement

Collapse
No announcement yet.

Modules in PowerBASIC

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Modules in PowerBASIC

    I am moving on from QuickBASIC, which has the ability to support modules. I am wondering, how do I add a module to a PowerBASIC program without using $INCLUDE? I want to have the main program, MAIN.BAS, and the other program, FILE.BAS linked together, but not to be compiled in the same source file. (In QB, there is an advantage to separating the source files and including them as modules rather than as include files.) Thanks in advance

    ------------------

  • #2
    Use units (.PBU) and libraries (.PBL).
    For units. see "User's Guide", pages 150-152.
    For libraries, see pages 286-288.

    ------------------

    Comment


    • #3
      Right. Compile the "module" code into Units (.PBU files), and $LINK them into your main code.

      You can even build Libraries (.PBL files) of Units, and the compiler will only include the actual Units that are referenced in the library.

      The documentation is definitely the place to start learning more about Units and Libraries!

      ------------------
      Lance
      PowerBASIC Support
      mailto:[email protected][email protected]</A>
      Lance
      mailto:[email protected]

      Comment


      • #4
        Jose and Lance are very much on target for you.

        You might also keep in mind that a combination of the technique of
        both the $INCLUDE game as well as the .PBL game and/or .PBU game
        may be best.

        As this whole concept grows, keeping the variables, their types,
        and the general compiler directives the same for all your efforts
        spread across libraries can grow too! Try the technique of also
        using a master $INCLUDE file that does nothing but carry in the
        master combination of variable names, dimentioned arrays and all
        those neat things which are valuable to you!

        It can be one of the most miserable things you'll ever do to chase
        variable type differences for similar named thingees across nested
        SUBS and so on. An early habit of making sure that they are all
        the same across all of your work will save you untold hours of
        frustration.

        As you build it, don't be afraid to take the line space off there
        on the right to comment what these things do! Yeah I know, this
        is old stuff! But when the variable count romps up there toward
        the 2500 mark in a suite and averages 700 to 1000 in any given
        large program, *SOME* kind of organizational effort early on as
        you begin this blocking all the tasks into common called libraries,
        can pay you terribly large dividends --

        especially late in the wee hours of the morning when you
        are dogged tired and fuzzy eyed!




        ------------------
        Mike Luther
        [email protected]
        Mike Luther
        [email protected]

        Comment


        • #5
          Lance,

          I will see like PBDOS Units (projects) en static libs in PBCC & PBDLL

          Kind regards
          Stephane

          ------------------
          ICQ: 123632482

          Comment


          • #6
            Stephane, please keep the discussion "on-topic". We have also received your _multiple_ requests for "units" for PB/CC and PB/DLL.

            ------------------
            Lance
            PowerBASIC Support
            mailto:[email protected][email protected]</A>
            Lance
            mailto:[email protected]

            Comment

            Working...
            X