Announcement

Collapse
No announcement yet.

Prototyping

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

  • Prototyping

    I read some where in the forum about this but I could not find in a search..
    In making a DLL I have serveral functions/subs. One function/sub calls another. When I compile if I don't have the function/sub defined above the one that calls it I get an error message.

    In C its called prototyping, I don't know what it is called in PB.
    I placed the function delcarations at the top of the dll. But now I get a different error. (Block/scanned statements no allowed here.)

    Question: How do you do prototyping in PB?



    [This message has been edited by Shawn Tartaglia (edited April 19, 2000).]

  • #2
    Shawn,

    Its pretty much the same stuff, C/asm prototypes are the same thing as
    PowerBASIC's DECLARATIONS. They are best put in a seperate INCLUDE file
    and called at the top of the code for either the EXE or DLL. As normal you
    are safer to declare them before using them to avoid forward reference

    #COMPILE DLL

    #INCLUDE "MYFILE.INC" '<< put declarations in this file

    Then write your code after it.

    Regards,

    [email protected]

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

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

    Comment


    • #3
      Note that declarations are done using the DECLARE statement. So, for a function:
      Code:
      FUNCTION Foo (x AS INTEGER) AS INTEGER
        FUNCTION = x + 1
      END FUNCTION
      You would have a declaration that might look like this:
      Code:
      DECLARE FUNCTION Foo (x AS INTEGER) AS INTEGER
      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        Steve/Tom - That was the trick. DECLARE Thanks.

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


        [This message has been edited by Shawn Tartaglia (edited April 19, 2000).]

        Comment

        Working...
        X