Recent

Author Topic: Executable version fpc 2.7.1  (Read 5443 times)

elidorio

  • Sr. Member
  • ****
  • Posts: 295
Executable version fpc 2.7.1
« on: June 10, 2013, 04:07:59 am »
How to extract the version number in the Lazarus, I am using 2.7.1 FPC?
Lazarus 1.4.4 | FPC 2.6.4 | Windows / Linux Debian

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Executable version fpc 2.7.1
« Reply #1 on: June 10, 2013, 09:56:44 am »
For FPC version, use $I (INCLUDE) compiler directive - see: http://www.freepascal.org/docs-html/prog/progsu41.html

For LCL version (ie. Lazarus version), include LCLVersion unit and use some of constants declared there.

For example, start new application, put two labels on the form, add LCLVersion unit to uses list and put the following in main form's OnCreate event:

Code: [Select]
procedure TForm1.FormCreate(Sender: TObject);
begin
  Label1.Caption := 'fpc version: ' + {$i%fpcversion%};
  Label2.Caption := 'lazarus version: ' + lcl_version;
end;
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

exdatis

  • Hero Member
  • *****
  • Posts: 668
    • exdatis
Re: Executable version fpc 2.7.1
« Reply #2 on: June 10, 2013, 10:02:15 am »
Thank you very much, Zoran!

elidorio

  • Sr. Member
  • ****
  • Posts: 295
Re: Executable version fpc 2.7.1
« Reply #3 on: June 10, 2013, 02:33:20 pm »
I expressed myself badly!

Want to get the version of my exe from my application.
Lazarus 1.4.4 | FPC 2.6.4 | Windows / Linux Debian

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Executable version fpc 2.7.1
« Reply #5 on: June 10, 2013, 09:28:34 pm »
I expressed myself badly!

Want to get the version of my exe from my application.

Read this thread: http://www.lazarus.freepascal.org/index.php/topic,12435.0.html
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

elidorio

  • Sr. Member
  • ****
  • Posts: 295
Re: Executable version fpc 2.7.1
« Reply #6 on: June 11, 2013, 01:58:02 am »
TVersionInfo (fileinfo unit) re-implemented in a platform independent way

    Old behaviour: GetVersionSetting method would read file information.
    New behaviour: The ReadFileInfo call will read the information. The global GetProgramVersion call will extract the program major/minor/revision/build version in 1 single call.
    Reason: The unit now uses FPC resources on all platforms, and can now be used to read external resources.
    Remedy: Use the ReadFileInfo call to get the version information. Add relevant units for desired resource support to your uses clause; e.g. if you need to read Windows .exe file info, add winpeimagereader


Sorry, can not implementing this code.
Lazarus 1.4.4 | FPC 2.6.4 | Windows / Linux Debian

Zoran

  • Hero Member
  • *****
  • Posts: 1988
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Executable version fpc 2.7.1
« Reply #7 on: June 11, 2013, 11:37:42 am »
By following the thread I linked in my previous post (which uses unit vinfo), I can get my application version with FPC 2.6.2.
However, I can't test with FPC from trunk, as I use only stable FPC.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

elidorio

  • Sr. Member
  • ****
  • Posts: 295
Re: Executable version fpc 2.7.1
« Reply #8 on: June 12, 2013, 03:26:51 am »
n my lazarus 1.08 fpc 2.6.2. I already have this code working, problem is that this code does not work with Lazarus 2.7.1. Because it has changed this unit GetVersionSetting.
I am not able to implement this code.
Lazarus 1.4.4 | FPC 2.6.4 | Windows / Linux Debian

 

TinyPortal © 2005-2018