views:

788

answers:

5

I have an old Delphi codebase I have to maintain, lots of DLLs, some older than others. In some of these DLLs there is no version information in the Project Options dialog. The controls for adding a version are greyed out and I can't even add a version number by manually editing the .DOF file. How can I include a version number in these projects?

+8  A: 

Check if the default .RES file exists in the project source location. Delphi includes the version number of the project in a .res file with the same name as the .dpr file. If the .RES file does not exist, the simplest way to recreate it is to add the {$R *.RES} compiler directive to the .DPR file, immediately after the uses clause.

library foolib;    

uses
    foo in 'foo.pas',
    baz in 'baz.pas';

{$R *.RES}

exports
    foofunc name 'foofunc';

end;

As soon as you add the {$R *.RES} compiler directive Delphi will tell you it has recreated the foolib.res resource file.

John Ferguson
+1  A: 

You can create and embed resource files in libraries created under Delphi, by using the $R directive.

This link has information relevant to constructing the RES file. Delphi has its own resource compiler: BRCC32

Andrew
Didn't John already wrote that?
gabr
Yes, but I didn't mention the BRCC32.
John Ferguson
:-( Given that John answered the question at the same time I was writing mine (and hence I didn't see his) I thought the down-vote was a little harsh! - I also provided a link to resource information *and* mentioned the resource compiler! It's almost enough to make me stop smiling!
Andrew
@Andrew I just logged in today and saw I got an upvote for my answer as well as the question, so I gave you a vote too. Has it really been 2 years?
John Ferguson
A: 

I use a build control system (FinalBuilder) and that is able to add version resources to all my DLLs and EXEs that are all coherent. Therefore I can be confident that the file set is all labelled with the same build. There are some Delphi projects that don't have versions by default, and FB will add them for you anyway.

mj2008
Sounds interesting. I'll bear it in mind for future projects.
John Ferguson
+4  A: 

It seems the resource directive {$R *.RES} is missing (or enclosed in conditional defines) in your .dpr file so that the IDE doesn't find it.

TOndrej
A: 

Inclusion of version info in dll's is a bit erratic. If you specify a lib_suffix the version info is not updated.

David M