0

I am working on a cpp application which generates a dll e.g base.dll . I have some applications that use this dll e.g A.exe, B.exe .

I am trying to get the product version of A.exe and B.exe in base.dll. I am using c++11 and boost. I am compiling this dll for both Windows and Linux.

Currently I am able to get the process name using boost by doing something like this:

std::string pname = boost::log::aux::get_process_name();

I am looking for a similar API to get the product version. Any feedback would be appreciated.

  • 1
    Why can't you make a function in your base.dll that just returns a std::string? – Anon Mail Nov 02 '16 at 21:00
  • Win32 API: `GetModuleHandle` passing in NULL; then `GetModuleFileName` passing in the module handle; then `GetFileVersionInfo` passing in the file name. Boost no idea. Links https://msdn.microsoft.com/en-us/library/windows/desktop/ms683199(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/desktop/ms647003(v=vs.85).aspx – Richard Critten Nov 02 '16 at 21:03
  • @AnonMail can you elaborate on the implementation of function? I need the product version from the exe. I am setting that version in the application using CMAKE. – Umang Mukesh Mehta Nov 02 '16 at 21:06
  • @UmangMukeshMehta when you say you are setting the version, what exactly does that mean? Having the version as part of the exe name? – Anon Mail Nov 02 '16 at 21:09
  • @RichardCritten I did get info on the API by following the S.O http://stackoverflow.com/questions/940707/how-do-i-programatically-get-the-version-of-a-dll-or-exe-file. But I am looking for something that can be cross compiled so that I can use it for Linux too. – Umang Mukesh Mehta Nov 02 '16 at 21:10
  • @AnonMail I am using cmake to compile all the dll's and the application. I set the BUILD_NUMBER in cmake which is used for all my projects. So for one of the application in csharp I use the BUILD_NUMBER from CMAKE and set the AssemblyFileVersion and AssemblyVersion when compiling. What I need is during run-time of the application a way for it to convey to the dll the version. – Umang Mukesh Mehta Nov 02 '16 at 21:14
  • I'm not familiar with CMAKE and the Asssembly terms you've used. Sorry. – Anon Mail Nov 02 '16 at 21:18

0 Answers0