Announcement

Collapse

Documentation

All current versions of the PowerBASIC documentation are available for download/viewing here:

PowerBASIC Links
See more
See less

#LINK [SLL] and #COMPILE compiler directives

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

  • #LINK [SLL] and #COMPILE compiler directives

    Use caution when #LINKing Static Link Libraries to avoid getting a compile-time error 637 when the SLL was created with PB/Win and you are attempting to link into a PB/CC program or vice-versa. See this post:

    https://forum.powerbasic.com/forum/u...411#post814411

    .. and a few which follow in that thread (full thread for above at https://forum.powerbasic.com/forum/u...ow-to-use-link)

    This restriction/limitation/caution is not found in the PB documentation under either #LINK or #COMPILE

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

  • #2
    Use caution when #LINKing Static Link Libraries to avoid getting a compile-time error 637 when the SLL was created with PB/Win and you are attempting to link into a PB/CC program or vice-versa. See this post:

    https://forum.powerbasic.com/forum/u...411#post814411
    That is NOT what was said in that thread.

    An SLL compiled in PBWin and containing DDT will not compile with PBCC. If no DDT it will compile without error in PBCC.

    Reverse is also true. An SLL compiled in PBCC and containing console code will not compile with PBWin. If no console code it will compile in PBWin.

    The documentation should mention the GUI/CLI limitation of cross-compiler use of SLLs. IF/THEN, SELECT CASE, string manipulation, file operations, etc, etc, etc, etc will work fine in an SLL no matter which compiler was used to create them.

    Cheers,
    Dale

    Comment


    • #3
      Originally posted by Dale Yarker View Post
      The documentation should mention the GUI/CLI limitation of cross-compiler use of SLLs. IF/THEN, SELECT CASE, string manipulation, file operations, etc, etc, etc, etc will work fine in an SLL no matter which compiler was used to create them.
      Or more generically:
      An SLL compiled with PBCC or PBWIN can be linked in both compilers if, and only if, it does not contain any compiler specific statements/functions.
      If an SLL uses any statement/function unique to a specific compiler (PBCC or PBWin), trying to #LINNK it will generate a compile time error.637.

      Note that "GUI" is not a limitation per se. A cross-compiler SLL can contain TXT or GRAPHIC WINDOW functions.

      Comment


      • #4
        The distinctions are pretty straight forward once you are used to them. PBWIN specific functions should only be used with PBWIN. PBCC specific functions should only be used with PBCC. Either compiler will say horrible things about your code if you mix them up. Anything else works in both compilers.
        Code:
            #compile exe "yourfile.exe"
            #compiler "PBCC"
            #link "YourLib.ext"
        or
        Code:
            #compile exe "yourfile.exe"
            #compiler "PBWIN"
            #link "YourLib.ext"
        Can't be much easier than that.
        hutch at movsd dot com
        The MASM Forum - SLL Modules and PB Libraries

        http://www.masm32.com/board/index.php?board=69.0

        Comment


        • #5
          If it works sometimes and not others, isn't "Use Caution" an appropriate suggestion?
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Strictly compile time, how about "Be aware"?
            Dale

            Comment


            • #7
              Michael,

              I think its get the context first, UI versus console, the two compilers share a massive amount of code but their different targets say what is specific to each compiler. The next things is to remember the difference. I regularly get caught leaving a "WAITKEY$" in code that I developed in PBCC then used in PBWIN. I don't use DDT so I don't get caught the other way.
              hutch at movsd dot com
              The MASM Forum - SLL Modules and PB Libraries

              http://www.masm32.com/board/index.php?board=69.0

              Comment


              • #8
                Another note of caution. Both PBCC and PBWIN have a "?" command, but they are compiler specific.
                So SLL code containing "?" will compile with either compiler, but PBCC compiles it as PRINT, PBWIn compiles it as MSGBOX - making the SLL un-linkable with the "other" compiler.

                (Consider the use of an API Messagebox or a TXT window if you need need to display text in a cross-compilable SLL)
                Last edited by Stuart McLachlan; 7 May 2022, 11:38 PM.

                Comment

                Working...
                X