No announcement yet.

Enbeded Date

  • Filter
  • Time
  • Show
Clear All
new posts

  • Enbeded Date

    How can I Compile a date into my program? So that every time I compile it it will have the date of compile time enbeded into it.

    Bobby Gage II

  • #2
    I use an $INCLUDE file that contains a single line of code, such as:

    Version$ = "12.4.2000.05.98.Build2165"

    I wrote a "MAKE" program that creates this file and increments the build number each time, before using SHELL to PBC.EXE to compile the code (actually I generate a batch file to launch the compiler as I often build 50 to 100 files at a time).

    This way, every file that needs to track a version, date & build number simply contains the $INCLUDE line and it is compiled with this string... only one file is ever needed to be modified in order to change the build niumber of the whole project.

    In addition, I have an option in my MAKE program that compares the date and time of the .BAS/.INC files to the EXE/PBC/.PBU files, and only compiles them if the source is more recent... handy for the "quick" test, but still allowing a full compilation if I change one of my "core" .INC files.

    Also, I use a second .INC file (called DEBUG.BAS) that is included in each file in the project as the very first line of code... I use this file to set all my equates, which can be useful for making demo or customized builds of the project (using conditional compilation, such as $IF %DEMO/$ENDIF, etc).

    For example:
    %DEMO = -1
    %CUSTOMBUILD_1 = 0
    %CUSTOMBUILD_2 = -1

    The advantage to this is simple: edit the DEBUG.BAS file and recompile the whole project - simple, and very effective. Works great for testing the different versions too... it only takes seconds to build a demo version for testing new features, and then rebuilding as a non-demo version for the final tests, etc.

    Works for me... YMMV.

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


    • #3
      I had a fealing that you should say that!!! That's what I was thinking of because if have a batch file that compiles about 10 files at one time and even packages them up into an installer and CD-Image. I will just add this code to that. Thanks...

      Bobby Gage II