Announcement

Collapse
No announcement yet.

I have an error i can't solve

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

  • I have an error i can't solve

    The code is a stripped version of real code, the following is nonsense but should compile.
    Can you please verify if this works with PB9???

    Code:
    #Compile Dll
    #Dim All
    
    Function TEST() As Long
    #If %pb_exe
    If 0 <> 1 Then
    End If
    #EndIf
    End Function
    
    Function LibMain (ByVal hInstance   As Long, _
                      ByVal fwdReason   As Long, _
                      ByVal lpvReserved As Long) As Long
    
    
    
    End Function
    I get:
    Code:
    PowerBASIC for Windows
    PB/Win  Version 9.00 
    Copyright (c) 1996-2008 PowerBasic Inc.
    Venice, Florida USA
    All Rights Reserved
    
    Error 600 in C:\DOCUME~1\EDWINK~1\BUREAU~1\NIEUWE~2\test.bas(11:010):  Macro phase error, referenced before define  0000:0016
    Line 11: Function LibMain (ByVal hInstance   As Long, _
    Here is the 8.04 log:
    Code:
    PowerBASIC for Windows
    PB/Win  Version 8.04 
    Copyright (c) 1996-2007 PowerBasic Inc.
    Venice, Florida USA
    All Rights Reserved
    
    Primary source:  C:\DOCUME~1\EDWINK~1\BUREAU~1\NIEUWE~2\test.bas   {18 total lines}
    Target compilation:  test.dll
    Compile time:  0.1 seconds, at 21600 lines/minute
    
    308 bytes compiled code, 1287 bytes RTLibrary,
    0 bytes string literals, and 1356 bytes dgroup.
    DLL does not require stack allocation.
    Disk image: 5120 bytes   Memory image: 2643 bytes.
    
    Component Files:
    ----------------
    C:\DOCUME~1\EDWINK~1\BUREAU~1\NIEUWE~2\TEST.BAS
    hellobasic

  • #2
    Use #If %DEF(%pb_exe) instead of #If %pb_exe.
    Built-in equates can now be redefined before used.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      > Error 600 in C:\DOCUME....

      601-615 Internal error - If one of these errors occurs, please report it to the PowerBASIC Technical Support group.
      (600 does not exist in PB/Win 8.03. Must be a new error. You must have found it.)
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Originally posted by José Roca View Post
        Use #If %DEF(%pb_exe) instead of #If %pb_exe.
        Built-in equates can now be redefined before used.
        I don't understand what you mean.
        Acc. the help it should be 0 and thus available.
        It always exist.. true or false depending on the output type.
        hellobasic

        Comment


        • #5
          What is error description for 600 in 9x help?

          If missing, well, that's a standalone bug all by itself.
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Can one confirm that an error occures?
            hellobasic

            Comment


            • #7
              Originally posted by Michael Mattias View Post
              What is error description for 600 in 9x help?

              If missing, well, that's a standalone bug all by itself.
              It's not mentioned, 601 is..
              hellobasic

              Comment


              • #8
                > Use #If %DEF(%pb_exe) instead of #If %pb_exe.

                Jose if that were required, the error message should be "equate not defined" or something close to that.

                "macro phase error" sure has sex appeal though, even if in a scary kind of way.
                Michael Mattias
                Tal Systems (retired)
                Port Washington WI USA
                [email protected]
                http://www.talsystems.com

                Comment


                • #9
                  I don't understand what you mean.
                  Acc. the help it should be 0 and thus available.
                  It always exist.. true or false depending on the output type.
                  If you are using #COMPILE DLL then %PB_DLL will be defined and %PB_EXE not, and viceversa.

                  Try to compile the following:

                  Code:
                  #COMPILE EXE
                  
                  FUNCTION PBMAIN () AS LONG
                  
                     MSGBOX STR$(%PB_DLL)
                  
                  END FUNCTION
                  and you will get error 460: Undefined equate.


                  Jose if that were required, the error message should be "equate not defined" or something close to that.

                  "macro phase error" sure has sex appeal though, even if in a scary kind of way.
                  This is the error that you get if you try to use it, as in the above MSGBOX STR$(%PB_DLL), but as it is in an #IF metastatement, it is causing the failure of the #IF.
                  Forum: http://www.jose.it-berater.org/smfforum/index.php

                  Comment


                  • #10
                    So.... a "macro phase error" is the same as an "undefined equate in compiler metastatement" error???

                    Darned, I should have been able to figure that out myself!
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      Edwin...I can't confirm under 9, but from the 8 (quoinky-Dink by the way because I was working on a error handling routine of my own, that I happened to find in the docs)

                      'Avoid using error numbers higher than 240, as they are reserved for use in critical error situations which can never be trapped with ON ERROR.
                      It could have changed, or could have nothing to do with your problem, but just in case I thought I would offer.

                      Unfortunately still eagerly expecting my 9 like a kid on Xmas, but come to find out my boss did not do it till last week and I suspect some delay of hurricanes...so I gotta suffer till I see (although THANK YOU to PB for alerting me that the order was received and will soon be on its way)
                      Engineer's Motto: If it aint broke take it apart and fix it

                      "If at 1st you don't succeed... call it version 1.0"

                      "Half of Programming is coding"....."The other 90% is DEBUGGING"

                      "Document my code????" .... "WHYYY??? do you think they call it CODE? "

                      Comment


                      • #12
                        if the function is moved passed LIB MAIN it will compile without any problems
                        Sr. Software Development Engineer and Sr. Information Security Analyst,
                        CEH, Digital Forensic Examiner

                        Comment


                        • #13
                          I got the same error in PB9. Didn't figure out how to fix it, but I got it. added: And like Thomas said, moving it makes it compile okay.
                          Last edited by John Gleason; 3 Sep 2008, 07:19 PM.

                          Comment


                          • #14
                            Moving the function is no option.
                            It is part of a big app and relocations like that is not what i intend to do.
                            So one person confirmed at least, we'll see.

                            Jose, the help states it is present but true or false.
                            This worked for years.
                            I already tried to def() it and add it myself.
                            It can not be done.

                            If you test this code you may see that when you remove the if 1 <> 0 then situation, it will work.
                            hellobasic

                            Comment


                            • #15
                              If you test this code you may see that when you remove the if 1 <> 0 then situation, it will work.
                              It's been a long time since I was in high school, but isn't that test ALWAYS true, meaning no test is necessary?
                              Michael Mattias
                              Tal Systems (retired)
                              Port Washington WI USA
                              [email protected]
                              http://www.talsystems.com

                              Comment


                              • #16
                                See first message/line
                                hellobasic

                                Comment


                                • #17
                                  FYI, i have sent this to support this morning.
                                  hellobasic

                                  Comment


                                  • #18
                                    I still have NO stable solution for using the predefined constants in the compiler!!

                                    #If %PB_CC32 And %PB_REVISION >= &H500
                                    %HASCOMSUPPORT = 1
                                    #ElseIf %Def( %PB_WIN32 ) And %PB_REVISION >= &H900
                                    %HASCOMSUPPORT = 1
                                    #EndIf

                                    Pay attention, the %PB_CC32 constant should be present according the help.
                                    In PB9 it's no longer present.

                                    What is going on?
                                    The help is not correct, in fact there are changes between PB8 and 9.
                                    How on earth create stable detect stuff this way.

                                    Thanks!
                                    hellobasic

                                    Comment


                                    • #19
                                      >Pay attention, the %PB_CC32 constant should be present according the help.

                                      Only if compiling with PB/CC according to my (4x, 8x) help...
                                      %PB_CC32 Pre-defined as TRUE (non-zero) in PB/CC for Windows, but is not defined in other compilers.
                                      You need to %DEF() test for %PB_cc32, %pb_dll and %pb_win32 before using them.
                                      Code:
                                      #IF %DEF(%PB_cc32) 
                                           #IF %pb_revision .....
                                                whatever
                                           #ENDIF
                                      #ENDIF
                                      Michael Mattias
                                      Tal Systems (retired)
                                      Port Washington WI USA
                                      [email protected]
                                      http://www.talsystems.com

                                      Comment


                                      • #20
                                        There is a difference between:
                                        http://www.powerbasic.com/support/he...F_operator.htm

                                        And:
                                        http://www.hellobasic.com/images/pb_def.png

                                        Maybe i haven't update my first download properly??
                                        hellobasic

                                        Comment

                                        Working...
                                        X