Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

#OPTION VERSION?

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

  • #OPTION VERSION?

    How can i use the #OPTION VERSION? with metastatements?

    i want to do something like this:
    #OPTION VERSION3
    #IF VERSION3
    ' #OPTION VERSION3 was set
    #ELSIF VERSION4
    ' #OPTION VERSION4 was set
    #ENDIF

    Thank you,
    Josef Lindinger
    mailto:[email protected][email protected]</A>
    www.selisoft.com


    [This message has been edited by Josef Lindinger (edited May 17, 2000).]

  • #2
    Is what you are asking for dependent on the machine you are compiling on?
    One would assume so, but after compiled it will be optimized for that OS that you compiled on.


    Anyway, not sure if you can do this or not:
    Global osver as OSVERSIONINFORMATION 'I could be wrong..
    $IF
    GetOSVersionInfo osver, sizeof(osver)
    osver.dwmajorversion = 4 Then
    #option Version4
    else
    #option Version3
    $END IF

    Scott


    ------------------
    Scott
    mailto:[email protected][email protected]</A>
    Scott Turchin
    MCSE, MCP+I
    http://www.tngbbs.com
    ----------------------
    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

    Comment


    • #3
      Scott --

      That won't work because #OPTION VERSION is a compile-time directive that tells the compiler how to assemble the program. If you use 3 your program is built one way, and if you use 4 it is built another way. You can't use run-time code to tell PB/DLL "I'm running on NT4... please go back in time and compile the program differently.

      Josef --

      I think you want to do something like this...

      Code:
      %CompiledForVersion3 = 1  'use any equate name you like
      
      #IF %CompiledForVersion3 THEN
          #OPTION VERSION3
      #ELSE
          #OPTION VERSION4
      #ENDIF
      ...and then you could use the %CompiledForVersion3 equate throughout your program, to determine how the program was compiled.

      -- Eric




      ------------------
      Perfect Sync: Perfect Sync Development Tools
      Email: mailto:[email protected][email protected]</A>

      "Not my circus, not my monkeys."

      Comment


      • #4
        %CompiledForVersion3 = 1 'use any equate name you like

        #IF %CompiledForVersion3 THEN
        #OPTION VERSION3
        #ELSE
        #OPTION VERSION4
        #ENDIF

        ...and then you could use the %CompiledForVersion3 equate throughout your program, to determine how the program was compiled.
        ------------
        That´s exact the way i did it. I just wanted to know if i can use the #OPTION-Flag for conditional compiling instead of using equates.

        BTW: How does the compiler use the version3/4/5-flags?
        What difference does the compiler if version3 is set instead of version5?

        Thank you,



        ------------------
        Josef Lindinger
        mailto:[email protected][email protected]</A>
        www.selisoft.com

        Comment


        • #5
          #OPTION VERSION n
          is not a flag, but a compile-time meta-statement. In other words, it is a compiler directive.

          The use of this meta-statement tells the compiler to include an O/S version test (for use at app startup) to verify that the app can be permitted to execute (ie, that the app is compatible with the O/S).

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

          Comment


          • #6
            Originally posted by Lance Edmonds:
            #OPTION VERSION n
            is not a flag, but a compile-time meta-statement. In other words, it is a compiler directive.

            The use of this meta-statement tells the compiler to include an O/S version test (for use at app startup) to verify that the app can be permitted to execute (ie, that the app is compatible with the O/S).

            Hmm, i just tried to compile a new exe with "#option version5" set. I have no trouble to start this exe with Windows NT4. When will the version test be executed?

            ------------------
            Josef Lindinger
            mailto:[email protected][email protected]</A>
            www.selisoft.com

            Comment


            • #7
              Good question... I'll ask and see what I can find out.

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

              Comment

              Working...
              X