Announcement

Collapse
No announcement yet.

#OPTION VERSION?

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

  • Lance Edmonds
    replied
    Good question... I'll ask and see what I can find out.

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

    Leave a comment:


  • Josef Lindinger
    replied
    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

    Leave a comment:


  • Lance Edmonds
    replied
    #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>

    Leave a comment:


  • Josef Lindinger
    replied
    %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

    Leave a comment:


  • Eric Pearson
    replied
    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>

    Leave a comment:


  • Scott Turchin
    replied
    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>

    Leave a comment:


  • Josef Lindinger
    started a topic #OPTION VERSION?

    #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).]
Working...
X