Version info for DLL

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Version info for DLL

Postby thedmd » Sat Jun 12, 2010 4:31 pm

Hello,

It is possible for you Julio to include *.rc in your project with information about version of Newton? At the moment I'm starting to be confused, because I have at least tree different versions of Newton in different projects. Sometimes I just copy wrong DLL.

If you like you may also include copyright to make some Newton users happy. : )
Also, url to this page can be put in there (free advertisement).
thedmd
 

Re: Version info for DLL

Postby Julio Jerez » Sat Jun 12, 2010 7:39 pm

what is a .rc file
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Version info for DLL

Postby thedmd » Sat Jun 12, 2010 9:14 pm

This is resource file which is used to embed various data directly in executable (ex. images, icons, version info).
If you are using Visual Studio, everything can be done thought wizard.
thedmd
 

Re: Version info for DLL

Postby Julio Jerez » Sat Jun 12, 2010 10:48 pm

I never used that, can you give an example how to do it and how will it be used.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Version info for DLL

Postby thedmd » Sat Jun 12, 2010 11:45 pm

Please try to save this into file named, for example, 'version.rc' and add it to the project. Then just build and voila.

With this I and anyone else will be able to identify exact release of your library:
Image

Code: Select all
1 VERSIONINFO
    FILEVERSION 2,22,0,0
    PRODUCTVERSION 2,22,0,0
    FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
    FILEFLAGS 0x1L
#else
    FILEFLAGS 0x0L
#endif
    FILEOS 0x40004L // VOS_NT_WINDOWS32
    FILETYPE 2      // VFT_DLL
    FILESUBTYPE 0x0L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "04090000"
        BEGIN
            VALUE "ProductName", "Newton Game Dynamics"
            VALUE "ProductVersion", "2.22"
            VALUE "OriginalFilename", "newton.dll"
            VALUE "LegalCopyright", "Copyright (C) 2003-2010 Julio Jerez, Alain Suero"
            VALUE "Website", "http://newtondynamics.com"
            VALUE "Comments", "Newton Game Dynamics Physics Engine"
#ifdef _WIN64
            VALUE "Architecture", "x86"
#else
            VALUE "Architecture", "x64"
#endif
#ifdef __USE_DOUBLE_PRECISION__
            VALUE "Precission", "Single"
#else
            VALUE "Precission", "Double"
#endif
        END
    END
END
thedmd
 

Re: Version info for DLL

Postby Julio Jerez » Sun Jun 13, 2010 1:11 am

Ok I added this

1 VERSIONINFO
FILEVERSION 2,22,0,0
PRODUCTVERSION 2,22,0,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L // VOS_NT_WINDOWS32
FILETYPE 2 // VFT_DLL
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "04090000"
BEGIN
VALUE "ProductName", "Newton Game Dynamics"
VALUE "ProductVersion", "2.22"
VALUE "OriginalFilename", "newton.dll"
VALUE "LegalCopyright", "Copyright (C) 2003-2010 Julio Jerez, Alain Suero"
VALUE "Website", "http://newtondynamics.com"
VALUE "Comments", "Newton Game Dynamics Physics Engine"
#ifdef _WIN64
VALUE "Architecture", "x86"
#else
VALUE "Architecture", "x64"
#endif
#ifdef __USE_DOUBLE_PRECISION__
VALUE "Precission", "Single"
#else
VALUE "Precission", "Double"
#endif
END
END
END


but for what I can see ther is a lot of editing going on each time I make a new build.
how that worlk? and how can it be used in static libraries.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Version info for DLL

Postby Julio Jerez » Sun Jun 13, 2010 1:13 am

how do you open this dialog in visual studio? I have never seem that

Image
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Version info for DLL

Postby thedmd » Sun Jun 13, 2010 8:52 am

Julio Jerez wrote:but for what I can see ther is a lot of editing going on each time I make a new build.
how that worlk?

Editing can be avoided. I thing following changes will do the trick:

In 'newton.h' you have two definitions: NEWTON_MAJOR_VERSION and NEWTON_MINOR_VERSION. They can be used to automatically fill necessary information in resource file.

1. First everything in newton.h after mentioned macros should be surrounded by for example:
Code: Select all
//********************************************************************
// Newton Game dynamics
// copyright 2000-2004
// By Julio Jerez
// VC: 6.0
// One and only header file.
//********************************************************************

#ifndef NEWTON_H__736495_6495_076__INCLUDED_
#define NEWTON_H__736495_6495_076__INCLUDED_


#define NEWTON_MAJOR_VERSION 2
#define NEWTON_MINOR_VERSION 15

#ifndef NEWTON_VERSION_ONLY

// REST OF THE HEADER

#endif /* NEWTON_VERSION_ONLY */
#endif /* NEWTON_H__736495_6495_076__INCLUDED_ */


2. Now resource file can be modified in this way:
Code: Select all
#define NEWTON_VERSION_ONLY

#include "Newton.h"

#define STRINGIZE_(value) #value
#define STRINGIZE(value)  STRINGIZE_(value)

#define NEWTON_VERSION      NEWTON_MAJOR_VERSION, NEWTON_MINOR_VERSION, 0, 0
#define NEWTON_VERSION_STR  STRINGIZE(NEWTON_MAJOR_VERSION) "." STRINGIZE(NEWTON_MINOR_VERSION)

#ifdef _WIN64
#define NEWTON_ARCHITECTURE "x64"
#else
#define NEWTON_ARCHITECTURE "x86"
#endif

#ifdef __USE_DOUBLE_PRECISION__
#define NEWTON_PRECISION    "Double"
#else
#define NEWTON_PRECISION    "Single"
#endif

LANGUAGE 0x00, 0x00

1 VERSIONINFO
    FILEVERSION       NEWTON_VERSION
    PRODUCTVERSION    NEWTON_VERSION
    FILEFLAGSMASK     0x0000003FL       // VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
    FILEFLAGS         0x00000001L       // VS_FF_DEBUG
#else
    FILEFLAGS         0x00000000L
#endif
    FILEOS            0x00040004L       // VOS_NT_WINDOWS32
#ifdef _NEWTON_USE_LIB
    FILETYPE          0x00000007L       // VFT_STATIC_LIB
#else
    FILETYPE          0x00000002L       // VFT_DLL
#endif
    FILESUBTYPE       0x00000000L
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"                // U.S. English, Multilingual
        BEGIN
            VALUE "Comments",           "http://newtondynamics.com"
            VALUE "FileDescription",    "Newton Game Dynamics (Precision: " NEWTON_PRECISION ", Architecture: " NEWTON_ARCHITECTURE ")"
            VALUE "FileVersion",        NEWTON_VERSION_STR
            VALUE "InternalName",       "newton"
            VALUE "LegalCopyright",     "Copyright (C) 2003-2010 Julio Jerez, Alain Suero"
            VALUE "OriginalFilename",   "newton.dll"
            VALUE "ProductName",        "Newton Game Dynamics"
            VALUE "ProductVersion",     NEWTON_VERSION_STR
            VALUE "Architecture",       NEWTON_ARCHITECTURE
            VALUE "Precision",          NEWTON_PRECISION
        END
    END
    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END


I had updated version definition, because previous one was damaged, and file info was not displayed by Windows Explorer. Now it works:
Image

Extra values are not show by Windows Explorer so I added information about precision and architecture to description block. Also I fixed are typos.

In that way, you, as usual, keep up to date NEWTON_MAJOR_VERSION, NEWTON_MINOR_VERSION defines. They maybe should be used to to implement NewtonWorldGetVersion() if not already.

Julio Jerez wrote:and how can it be used in static libraries.

There is no way to distinguish static libraries in that manner. The only way I know to work is to use concrete naming scheme. For example {name}-{precission}-{version}-{compiler}-{runtime}-{architecture}.lib which gives following decoration: 'newton-single-2.22-vc90-mt-x64.lib'.
In that way all compiled libraries can be put in a single folder. This is convenient if you use some kind of auto tools to build whole release. Doing that by hand is just more annoying that limitations of static libraries.

Julio Jerez wrote:how do you open this dialog in visual studio? I have never seem that

This screen is from Total Commander listener with fileinfo plug-in. Some basic information about DLL you can obtain on property
thedmd
 

Re: Version info for DLL

Postby Julio Jerez » Sun Jun 13, 2010 10:38 am

Isee you can check by clicking properties in VS

It seems .rc files cannot read define from the compiler command line
I tryed doing this but not mater what I do the NEWTON_PRECISION alway resolve to "float"

Code: Select all
#ifdef __USE_DOUBLE_PRECISION__
   #define dFloat double
   #define NEWTON_PRECISION "double"
#else
   #define dFloat float
   #define NEWTON_PRECISION "float"
#endif

Is there somes special I need to do to make read define specifiied in teh command line.
I cna no figure out how to make
NEWTON_PRECISION and NEWTON_ARCHITECTURE be read from the commnad line
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Version info for DLL

Postby thedmd » Sun Jun 13, 2010 2:37 pm

Resource file is compiled by 'rc.exe' not 'cl.exe'. To pass define to the resource compiler use /d switch. This should help.

Is there any reason why you moved NEWTON_PRECISION to header?
thedmd
 

Re: Version info for DLL

Postby Julio Jerez » Sun Jun 13, 2010 3:24 pm

I think I got it, try this download and see if it works.
http://www.newtondynamics.com/downloads/NewtonWin-2.23.rar
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Version info for DLL

Postby thedmd » Sun Jun 13, 2010 4:44 pm

All kinds of newton.dll have now version information. Thank you.

There is a typo in precision naming. Now the names are: "Single", "double". They should be "single", "double" or "Single", "Double" to keep consistency.
thedmd
 

Re: Version info for DLL

Postby Julio Jerez » Sun Jun 13, 2010 6:20 pm

Ok, next version will be corrected.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron