Announcement

Collapse
No announcement yet.

What's wrong with this code?

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

  • What's wrong with this code?

    I'm getting a headache over this one.

    I've checked all the characters over and over again and I still get this error message right after the ALIAS clause : ") expected".

    When I take out the section marked "Public/Exported ..." there are no compile errors. When I retype everything just in case there's a hidden character somewhere I still get the error. When I take out the first DECLARE I get the same error on the very next line.

    All the SUBs are behaving this way and the FUNCTION just gives a "syntax error" on the empty parenthesis AND when I put "sText AS STRING" into the empty parenthesis. I've read the online help and the printed manual several times this afternoon -- my code looks correct to me.

    Either I'm going crazy or I'm doing something wrong. I took my meds today, so I'm inclined to think I'm doing something wrong here.

    Code:
    #COMPILER PBWIN 8.04 'compiler required for this code
    #COMPILE DLL         'generate a Windows Dynamic Link Library
    #DEBUG ERROR ON      'remove this line for final build
    
    OPTION EXPLICIT      'all variables must be declared before use
    
    'Windows API & PBForms include
    #INCLUDE "Win32api.inc"    'for Windows API calls
    #INCLUDE "IPHlpAPI.inc"    'for API calls: GetAdaptersInfo() and GetIfTable()
    #INCLUDE "PBForms.INC"     'PB forms manager
    
    'VB6 modules and classes ported from v2
    #INCLUDE "ClassList.bi"
    #INCLUDE "ModList.bi"
    
    '==================================
    ' Unmodified PB generated code for a DLL here
    '==================================
    
    
    '=====================================================
    '  *** Public/Exported Library Methods/Functions ***
    '=====================================================
    DECLARE SUB ShowAbout ALIAS "ShowAbout" (ParentAppName AS STRING, _
                                             ParentAppVer AS STRING, _
                                             ESCAppName AS STRING, _
                                             ESCAppVer AS STRING) EXPORT
    
    DECLARE SUB ShowSystemInfo ALIAS "ShowSystemInfo" (ParentAppName AS STRING, _
                                                       ParentAppVer AS STRING, _
                                                       ESCAppName AS STRING, _
                                                       ESCAppVer AS STRING) EXPORT
    
    DECLARE SUB CheckLic ALIAS "CheckLic" (ParentAppName AS STRING, _
                                           ParentAppVer AS STRING,  _
                                           ESCAppName AS STRING, _
                                           ESCAppVer AS STRING, _
                                           Caller AS STRING,  _
                                           Flag AS INTEGER) EXPORT
    
    DECLARE SUB CSUCheckPassword ALIAS "CSUCheckPassword" (ParentAppName AS STRING, _
                                                           ParentAppVer AS STRING, _
                                                           ESCAppName AS STRING, _
                                                           ESCAppVer AS STRING, _
                                                           sOption AS STRING, _
                                                           OPTIONAL sPassword AS STRING) EXPORT
    
    DECLARE FUNCTION LetCSUPassword ALIAS "LetCSUPassword" () EXPORT AS STRING
    DECLARE SUB DecodeText ALIAS "DecodeText" (sText AS VARIANT) EXPORT
    DECLARE SUB EncodeText ALIAS "EncodeText" (sText AS VARIANT) EXPORT
    '=========================================================================================================
    Do not go quiet into that good night,
    ... Rage, rage against the dark.

  • #2
    Remove EXPORT from the declares.
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      Since I do not have the following files
      1. '#INCLUDE "ClassList.bi"
      2. '#INCLUDE "ModList.bi"

      I commented them out, and got "Line 16 ESCAppVer AS STRING) EXPORT
      with the cursor after string and before the )


      Do you have the whole listing? maybe some of us can see the glitch?
      (almost seems like one I see from time to time and can never nail down, cause once I fixed whatever it was...never saw it again (or at least in the same project)...and always wonder a bug? or something I did?)
      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


      • #4
        AFAIK, ALIAS is not used in a DECLARE statement unless there is also a LIB clause.
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          I will repeat it: Remove EXPORT from the declares.

          EXPORT is a valid keyword for functions and procedures, but not for the declares.

          You can do:

          Code:
          FUNCTION HalfOf ALIAS "HalfOf" (X!) EXPORT AS  SINGLE
             FUNCTION = X! / 2
           END FUNCTION
          but not

          Code:
          DECLARE FUNCTION HalfOf ALIAS "HalfOf" (X!) EXPORT AS  SINGLE
          Forum: http://www.jose.it-berater.org/smfforum/index.php

          Comment


          • #6
            Originally posted by José Roca View Post
            Remove EXPORT from the declares.
            Ok. I see that one. Removed them but the error didn't change.

            Originally posted by Cliff Nichols View Post
            Since I do not have the following files
            1. '#INCLUDE "ClassList.bi"
            2. '#INCLUDE "ModList.bi"
            I commented them out, and got "Line 16 ESCAppVer AS STRING) EXPORT
            with the cursor after string and before the )

            Do you have the whole listing? maybe some of us can see the glitch? ...
            That's interesting. It gives me an idea... I'll let you know if it works. Unfortunately, those 2 files are covered by an NDA, but if you got the error without them, perhaps there's something in the code before that. This is the simplified version after all.

            Originally posted by Michael Mattias View Post
            AFAIK, ALIAS is not used in a DECLARE statement unless there is also a LIB clause.

            Ok. I'll try that next. .... Interesting: that moves the error to right after the SUB ....

            I'm going for a cup of coffee and a smoke. Maybe it'll come to me in the mist. :confused2:

            10 minutes later --
            So, I commented EVERYHING out. The DECLARES compile just fine.
            One by one, I added the #INCLUDEs back in.

            Guess what I found?! no, hunh? well...
            I left a parenthesis out in BOTH of those proprietary files. Thanks Cliff.
            And thank Jose and MCM. That was very messy code I posted and you helped.

            Stan
            Last edited by StanHelton; 9 May 2008, 08:12 PM. Reason: Found the problem. doh.
            Do not go quiet into that good night,
            ... Rage, rage against the dark.

            Comment


            • #7
              Okay. There were a lot of problems with my DECLAREs and with my definitions. This is what it looks like when I finally got it to compile without errors.

              Thanks again to everybody who looked at it and helped me with this.



              Code:
              DECLARE SUB ShowAbout (ParentAppName AS STRING, ParentAppVer AS STRING, ESCAppName AS STRING, ESCAppVer AS STRING)
              DECLARE SUB ShowSystemInfo (ParentAppName AS STRING, ParentAppVer AS STRING, ESCAppName AS STRING, ESCAppVer AS STRING)
              DECLARE FUNCTION CheckLic (ParentAppName AS STRING, ParentAppVer AS STRING, ESCAppName AS STRING, ESCAppVer AS STRING, Caller AS STRING, Flag AS INTEGER) AS LONG
              DECLARE FUNCTION CSUCheckPassword (ParentAppName AS STRING, ParentAppVer AS STRING, ESCAppName AS STRING, ESCAppVer AS STRING, sOption AS STRING, OPTIONAL sPassword AS STRING) AS LONG
              DECLARE FUNCTION LetCSUPassword (sText AS VARIANT) AS STRING
              DECLARE FUNCTION DecodeText (sText AS VARIANT) AS STRING
              DECLARE FUNCTION EncodeText (sText AS VARIANT) AS STRING
              
              
              STATIC SUB ShowAbout ALIAS "ShowAbout" (ParentAppName AS STRING, _
                                                      ParentAppVer AS STRING, _
                                                      ESCAppName AS STRING, _
                                                      ESCAppVer AS STRING) EXPORT
                                                      
                 ShowfrmAbout %HWND_DESKTOP
              END SUB
              
              STATIC SUB ShowSystemInfo ALIAS "ShowSystemInfo" (ParentAppName AS STRING, _
                                                                ParentAppVer AS STRING, _
                                                                ESCAppName AS STRING, _
                                                                ESCAppVer AS STRING) EXPORT
                                                                
                 ShowfrmSystemInfo %HWND_DESKTOP
              END SUB
              
              
              STATIC FUNCTION CheckLic ALIAS "CheckLic" (ParentAppName AS STRING, _
                                                         ParentAppVer AS STRING, _
                                                         ESCAppName AS STRING, _
                                                         ESCAppVer AS STRING, _
                                                         Caller AS STRING, _
                                                         Flag AS INTEGER) EXPORT AS LONG
              END FUNCTION
              
              
              STATIC FUNCTION CSUCheckPassword ALIAS "CSUCheckPassword" (ParentAppName AS STRING, _
                                                                         ParentAppVer AS STRING, _
                                                                         ESCAppName AS STRING, _
                                                                         ESCAppVer AS STRING, _
                                                                         sOption AS STRING, _
                                                                         OPTIONAL sPassword AS STRING) EXPORT AS LONG
              END FUNCTION
              
              STATIC FUNCTION LetCSUPassword(sText AS VARIANT) AS LONG
              END FUNCTION
              
              STATIC FUNCTION DecodeText ALIAS "DecodeText" (sText AS VARIANT) EXPORT AS STRING
              END FUNCTION
              
              STATIC FUNCTION EncodeText ALIAS "EncodeText" (sText AS VARIANT) EXPORT AS STRING
              END FUNCTION
              Do not go quiet into that good night,
              ... Rage, rage against the dark.

              Comment

              Working...
              X