No announcement yet.

Basic Concept Check

  • Filter
  • Time
  • Show
Clear All
new posts

  • Basic Concept Check

    I hope you will indulge me. I haven't had PB/DLL 6.0 for very long and would like to ask some simple questions. My main experience is with VB6.0 and I am primarily creating add on DLLs to a VB program(s).

    1) Is the help file the "manual". Is this the same as the manual that can be ordered from Powerbasic? Is there anything more I could read as it seems very short? I've spent quite a bit of time on the site but it seems the most helpful source of info is this forum.

    2) Is there a way to debug a DLL without making it into an EXE?

    3) Is there an immediate window anywhere which is similar to the VB Immediate window? Is there an alternative way to do this?

    4) Is PowerGen an add on product? It says not installed when I click on it. Anyone want to provide a quick summary of what it does?

    5) In v2.00, does the Compiler Shell do the same thing that the v2.0 compiler does when you press the Build button? When I did it this way, the resulting DLL didn't seem to "work".

    6) If App A calls MyDLL.dll 3 times for instance, do the Global variables in MyDLL.dll remain the same for App A? Does App B get new Global variables from MyDll.dll when it calls a DLL function or the same global varibles as App A?

    Patrick White

  • #2
    For question 6, no, you get a new instance.


    Scott Turchin
    True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi


    • #3
      1. The help file contains almost exactly the same information as the manual.
      Very short, I dunno; the printed version is 369 pages. Yes, the Forums here
      are an excellent source of information. You might also refer to the Downloads
      area at

      2. There are many ways to debug a DLL without making it into an EXE but, if
      you mean debugging within the PowerBASIC IDE, the answer is "no".

      3. An "immediate window" is available only with interpreted languages.
      PowerBASIC is a compiler and does not offer this facility.

      4. PowerGEN is a utility that assists in designing GUI applications. For more
      information, see

      5. I don't understand this question. Perhaps you could rephrase or explain a
      bit more?

      6. The data space is owned by the .EXE, not by the .DLL. Think of the variables
      in MyDll.dll as belonging to App A or App B, not to the DLL itself. Each app will
      have its own separate data space.

      Tom Hanlin
      PowerBASIC Staff


      • #4
        Thanks for all the answers so far. To clarify #5.

        When PB/DLL was initially installed I got 2 icons in my PBDLL 6.0 program group: PBDLL 2.0 Compiler and PBDLL 2.0 Compiler Shell. I take it that both programs build DLLs in 16 bit windows the same way (you would get an identical DLL regardless of which way you chose to build it)? Maybe I was doing something wrong (quite possible since I was trying everyting for the first time). I would guess that both icons use the same compiler, just that the shell has more features on it?

        As a followup to #6, it sounds like it is not possible to build a singleton DLL in PB. Is this correct?

        Patrick White


        • #5
          Patrick, for question #2, what I do is that in the same .BAS file,
          I have an alternate section of code that allows me to simulate
          running a project that calls the DLL. I use "$If %Def(%pb_dll32)",
          for the section of code that is used when in debug mode. So
          whenever I want to compile the DLL, I load it with PB/DLL. When
          I want to give the DLL a test run, I load it from PB/CC. From
          there I can run it like a standalone and use the debugger on it.

          Tom, other compilers such as Microsoft VC++, and Delphi allow
          you to evaluate expressions at debug time. This
          would be a great feature to add to PowerBASIC.

          Daniel Corbier
          UCalc Fast Math Parser

          Daniel Corbier
          uCalc Fast Math Parser
          uCalc Language Builder


          • #6
            You can use %DEF(%PB_EXE) to test for EXE compilation as opposed to DLL compilation, enabling you to debug your DLL code as an EXE using just PB/DLL. For example:
            %DEBUG = 1
            #IF %DEBUG
              #COMPILE EXE
              #COMPILE DLL
            #IF %DEF(PB_EXE)
              FUNCTION PBMAIN
                CALL MyDllFunction()
              END FUNCTION
                FUNCTION = 1
              END FUNCTION

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


            • #7

              for all of the gismos around, a DLL in PowerBASIC is a reasonably
              simple number to write and test if you do it in position (meaning
              call it with the program it is intended to be called with) and display
              the direct bits and pieces in things like message boxes, title bars
              and status bars. A slightly more creative approach is to display
              whatever you want in a console window.

              Because they are very easy to write in PowerBASIC, I often write
              small DLLs to debug complicated algorithms in assembler because
              you can routinely convert data and display it in whatever format
              you like.

              Debuggers are messy things to deal with in a 32 bit multitasking
              operating system where directly displaying data in the middle of
              a callback is trivial to do.


              [email protected]

              hutch at movsd dot com
              The MASM Forum - SLL Modules and PB Libraries



              • #8
                I have simplified all my debugging to the use of OutputDebugString
                When I need to, I start DbgView.Exe from

                mailto:[email protected][email protected]</A>

                mailto:[email protected][email protected]</A>


                • #9
                  Patrick, yes, the PB/DLL 2.0 compiler shell is a small wrapper around the PB/DLL
                  2.0 compiler. It provides some conveniences by way of remembering your preferred
                  settings, resource files, and so forth. It calls the PB/DLL 2.0 compiler to do
                  the actual work of compiling. Note that PB/DLL 2.0 produces 16-bit DLLs, which
                  you are only likely to want if Windows 3.x support is important to you.

                  Not possible to build a singleton DLL in PB? Dunno about that. What is a
                  "singleton DLL"...?

                  Daniel, an expression evaluator is not the same thing as an immediate window.
                  It is likely that this feature will be added to the debugger at some point.

                  Tom Hanlin
                  PowerBASIC Staff