Delphi file types - delphi

I am looking for a list of all file types that can be associated to a Delphi project (all versions of Delphi), more specifically all file types that should be under source control.
This site doesn't mention Delphi 2009 so I'm not sure if there may be new file types.
Is there maybe such a list directly from Codegear?
Putting all the answers together, here is a list:
Files -> Source Control
.bdsgroup - Project Group
.bdsproj - Project
.bpg - Project Group
.cfg - Project Configuration
.dfm - Delphi Form
.dof - Project Options
.dpk - Package
.dpr - Project
.dproj - Project
.pas - Pascal File
.res - Resource File
.todo - IDE Todo
I am not sure about these: Should they be included?
.dem
.dro
.local
Maybe there is anything still missing?

Prior to Prism:
.pas is the source code - been that way in all versions
.dcu delphi compiled unit (compiled .pas file)
.dfm delphi form
.dpr Delphi project
.res resource file
.dpk delphi package
.dcp compiled version of dpk
.dpl/.bpl Windows DLL with Delphi specifics in it
.BPG, .BDSGROUP Borland Project group
.dcr compiled version of .res
.dof settings for solution
.dsk settings for IDE specific to the solution (i.e. what windows are open)
.dro This text file contains information about the object repository.
.dmt This proprietary binary file contains the shipped and user-defined menu templates information
.tlb Type library
.dem This text file contains some standard country-specific formats for a TMaskEdit component
From my limited work with Prism it seems
.pas is the source code - includes forms now
.dproj Delphi project
.resx resource file
.vsproj delphi package

Just a couple of extra ones that should not be included (at least I don't.):
.drc - generated on every compile (list of bound resources)
.map - map file
.dproj.local
.identcache
.groupproj.local
Ones that should:
.todo - Project todo file for IDE.
.inc - Delphi/Pascal Include files.
Others that depend on what your storing:
.groupproj - Delphi group of projects file

Here's a guide for setting up Subversion with Delphi. He uses this "Global Ignore Patterns" file filter for subversion:
I use
*.dcu *.~* dcu temp *.exe *.zip *.bkm *.ddp *.cfg *.dof *.dsk *.ini *.hlp *.gid
*.bmp *.png *.gif ~* *.log bin debug release *.map *.chm *.bkf Thumbs.db *.mdb
.obj *.elf *.stat *.ddp *.bpl *.map *.GID *.hlp *.opt *.dll *.raw *.BIN *.obj
*.pdb *.scc Debug Release *.xml obj *.~* *.backup *.INI *.ArmLog *.KeyLog
*.NanoLog *.Stats *.PreARM *.old *.drc *.*~ *.doc *.pdf *.bmp *.jpg *.MRW *.NEF
*.ORF *.psd *.X3F __history *.local *.identcache *.bak Thumbs.db *.ldb *.dex
*.rar DllDcu *.lck CVS cvs *.txt *.TXT *.jdbg *.HLP *.KWF *.xls *.cnt *.dsm
*.dti *.tmp *.lnk *.cbk *.mes
Note that the patterns are case sensitive.

From this link a .local file is for
Delphi/CB 2005 onwards: User-specific project options. When using Starteam projects it will
contain overrides to settings from the .bdsproj file.

The ".local" files probably SHOULD be included in version control - at least with Rad Studio 2010 (I haven't checked more recent versions).
They are XML files that include (among other cruft) the visual ordering of files in the project within each folder:-
<ProjectSortOrder AutoSort="0" SortType="0">
<File Path="..\PPP\base.optset"/>
<File Path="..\HPPP\debug.optset"/>
<VirtualFolder ID="{BC2DCF60-71AB-4F00-AFCB-CC7FA5414FB5}"/>
<VirtualFolder ID="{DFA8BFE5-37E7-45F6-B964-18198CB18581}"/>
<File Path="..\PPP\Xyzzy.cpp"/>
If you delete the .local files, the files in the project are shown in alphabetical order rather than the order you had dragged them into. This is a handy trick to quickly get your files back into alphabetical order!

Related

Symbol table debug information is not added in dll (delphi) after build it from CMD dcc32

I am trying to generate a .TDS file for a .DLL compiled with the command-line dcc32.exe compiler and a .CFG configuration file.
At the time of converting, I see that my DLL file does not have a symbol table. To cross check this, I check the size of the DLL before and after compiling, and it is the same. Please tell me what I am missing in my .CFG file that prevents symbol table debug information from being added to the DLL.
I am using Delphi 10. My .CFG file is as follows:
/B
/H-
/GD
/W-
/$A+
/$B-
/$C-
/$D+
/$E-
/$F-
/$G+
/$H+
/$I+
/$J+
/$K-
/$L+
/$M-
/$N+
/$O+
/$P+
/$Q+
/$R+
/$S+
/$T-
/$U-
/$V-
/$W+
/$X+
/$Y+
/AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
/$M16384,2097152
/K4194300
/NSData.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;System;Xml;Data;Datasnap;Web;Soap;System.Win;Winapi;Vcl;Vcl.Samples;Vcl.Imaging
/CC
/DTDMDLL;BOMDLL;TRACE_INPUTBOX;
/IH:\Shared\INC
/UH:\Shared\PAS\PasController
/UH:\Shared\VCL
/UH:\Shared\VCL\TMS\Current\TMSComponentPack
/UH:\3rdParty\Delphi
/UH:\Tlbs
/UH:\3rdParty\HyperAct
/UH:\3rdParty\GifImage
/UH:\3rdParty\Abbrevia2\Product
/UH:\3rdParty\Microsoft
/UH:\3rdParty\Microsoft\IExtractImage
/UH:\Shared\INC
/UH:\Shared\Pas
/UH:\Shared\Internal
/UH:\\Shared\VCL\ElPack\Code
/UH:\Shared\VCL\ElPack\Code\Design
/UH:\Shared\VCL\QR1
/UH:\Shared\VCL\ElPack\Code\Source
/UH:\Shared\VCL\ShortcutBar
/UH:\Shared\VCL\Hebrew
/UH:\Shared\VCL\ToolBar
/UH:\Shared\VCL\PlasmaTools\Src
/UH:\Shared\DataModelDesign\InDbFunctions
/UH:\Shared\DataModelDesign\DistributedDesign
/UH:\Shared\DataModelDesign\DataModelDesigner
/UH:\Shared\BldKit\PUBLIC\KitRes\PAS
/UH:\Shared\VCL\xBom
/UH:\Shared\VCL\xDiff
/UH:\Shared\VCL\DEVEXP~1\Current\EXPRES~3\Sources
-RH:\Shared\VCL -RH:\Shared\BldKit\VER
;Append Project Local Setting
/U H:\Shared\VCL\DevExpress\Current\ExpressBars 5\Sources\
/UH:\BOM\SmartBomConsolidation
Also, how can I can generate a .PDB file for the DLL?

How I Compile Resources into my Application and Access them?

How can I make a single executable package that contains DLL and Image Resource Files?
Then how do I extract them from my Executable at Runtime?
Option 1 using the IDE (Delphi 2007 or Higher):
You can click the Project menu, then select Resources..., which you can load any file into. For your purpose this would be RC_DATA.
Option 2 without the IDE
If you do not have the above option, you will need to use the BRCC32 (Borland Resource Compiler) to create a .RES file from RC file, which you then link to your Application. To link Resource files without using the IDE, try the following:
Lets say for example we want to add a a couple of DLL files, and the name of the DLL files are MyLib1.dll and MyLib2.dll, to add this open Notepad, and type the following:
MYLIB1 RCDATA "..\MyLib1.dll"
MYLIB2 RCDATA "..\MyLib2.dll"
Make sure the ..\xxx.dll paths are correct, so obviously you need to edit that.
Now you need to save this as a .rc file, so File>Save As..(make sure the dropdown filter is All Files .) and name it MyResources.rc. Now you need to use the Resource Compiler to generate the Res file, using this console command:
BRCC32 MyResources.RC
You can write that command by using the Command Prompt, Start Menu > Run > cmd.exe, alternatively you can find the BRCC32.exe inside the bin folder of your Delphi setup and drag the MyResource.RC file onto.
This will create a Res file named MyResources.RES which you can include inside the Main Delphi form of your Application, like so:
{$R *.dfm}
{$R MyResources.res}
you can extract the resources by using something like this:
procedure ExtractResource(ResName: String; Filename: String);
var
ResStream: TResourceStream;
begin
ResStream:= TResourceStream.Create(HInstance, ResName, RT_RCDATA);
try
ResStream.Position:= 0;
ResStream.SaveToFile(Filename);
finally
ResStream.Free;
end;
end;
What I've found out to be convenient, is to use a .zip container.
Then you'll have two implementations:
Append some .zip content to an existing .exe, and the .exe code will retrieve the .zip content on request;
Embed the .zip content as a resource, then extract on request each content.
Solution 1 will add the .zip content after compilation. Whereas 2 will add the .zip content at compilation. For a setup program, I think solution 1 makes sense to me. For a way of retrieving some needed files (libraries, and even bitmaps or text) which are linked to a particular exe release, solution 2 could be envisaged.
Using .zip as format make it easy to parse the content, and allow compression. Using a tool like TotalCommander, you can even read the .zip file content with Ctrl+PgDown over the .exe. Very convenient.
You'll find in this link how you implement solution 1, and in this link (same page, but another post) how to use the TZipRead.Create() constructor to directly access to a .zip bundled as resource. You'll find in our repository how it works with working applications: e.g. how we embedded icons, textual content and graphviz + spell-checker libraries in the SynProject executable.
About performance, there is no difference between the two solutions, at least with our code. Both use memory mapped files to access the content, so it will be more or less identical: very fast.

Delphi .res file changer

I'm looking for a ready-to-use piece of code that would be able to read and modify Delphi .res files. The thing is that I need to create an application that will be compiling many Delphi projects at once (using the dcc32.exe file). However, it is necessary for me to change file version and language before compilation, and as far as I know, I have to modify the .res file to do that.
Have you come across any code that would give me an interface to .res files allowing me to modify the data contained in it? The thing is that I want to change only those two pieces of information keeping the rest unchanged. This is why I can't compile my own .res file based on a script.
An application executed from a command line would also be OK if it allows to be called with parameters and does what I need it to do.
Thank you very in advance!
If all you need is to add file version resource then create appver.rc file, compile it with brcc32 and in one of your app unit (for example appver.pas) add {$R appver.res} (as Marian noticed you must turn off Delphi project option to include version info).
I created command line programs that increase build numbers in .rc file, create new branch/tag in SVN with new version in branch name, compiles .rc to .res, and build application.
My .rc files with such info (Polish language) looks like:
#define IDR_VERSION1 1
IDR_VERSION1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE
FILEVERSION 7,28,7,17
PRODUCTVERSION 7,28,7,17
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_DOS_WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE 0
{
BLOCK "StringFileInfo"
{
BLOCK "041504E2"
{
VALUE "CompanyName", "xxx\0"
VALUE "FileDescription", "yyy\0"
VALUE "ProductName", "zzz\0"
VALUE "FileVersion", "7.28.7.17\0"
VALUE "ProductVersion", "7.28.7.17\0"
}
}
BLOCK "VarFileInfo"
{
VALUE "Translation", 0x0415, 1250
}
}
For all things .res, look at Colin Wilson's "XN Resource Editor", for which he provides the source code: http://www.wilsonc.demon.co.uk/d10resourceeditor.htm
And probably all you need is his resource utility library:
http://www.wilsonc.demon.co.uk/d9resourceutils.htm
I haven't used this source, but if I needed it, that's the first place I'd look. His resource editor is very useful, btw.
There is ChangeRes which seems to match your needs.
Check out sources:
http://code.google.com/p/gedemin/source/browse/trunk#trunk/Gedemin/Utility/IncVerRC
It is our utility which reads .RC file with version information and increments build number. We use it inside our build process. Here is an excerpt:
incverrc.exe ..\gedemin\gedemin.rc
"%delphi_path%\brcc32.exe" -fogedemin.res -i..\images gedemin.rc
"%delphi_path%\dcc32.exe" -b gedemin.dpr
The utility uses TIncVerRc class written by Chris Morris.
Check Resource Tuner Console on www.heaventools.com. They position that product for tasks like yours. Also there's a free rcstamp tool on CodeProject.

Including resource file in a project by .RC file rather than .RES file

I remember reading an article or post somewhere years ago that suggested including a resource file in a project by referencing the .rc file instead of an already compiled .res file so that the resource is built as part of the project's build process.
I have a glyphs.rc file that I currently compile using the command brcc32 glyphs.rc. In my project file I then have the statement {$R Glyphs.res}.
I'd like to simplify this by changing it to something like
{$R Glyphs.rc}
but am unsure of the syntax. When I try using {$R Glyphs.rc} I get an error `
[DCC Error] E2161 Error: RLINK32: Unsupported 16bit resource in file "Glyphs.rc".
Is this approach possible with Delphi 2007?
Just add the rc file to your project via the "Project > Add to project" menu item. This creates the {$R 'myres.res' 'myres.rc'} line from the posting that TOndrej links to.
The linker can only handle res files, but you can direct the compiler to invoke the resource compiler and compile an rc script to produce a res file and link that, using a variation of the $R/$RESOURCE directive.
In your case (Delphi 2007) you should need only change:
{$r glyphs.res}
to
{$r glyphs.res glyphs.rc}
If this doesn't work on its own, try adding the RC to the project. In different versions of Delphi you may need single quotes around the filenames:
{$r 'glyphs.res' 'glyphs.rc'}
NOTE: You do still need to identify a res file, the difference is in being able to additionally identify the rc file to be compiled in order to produce the required res file in the first place.
Support for this appears to have been subject to some tinkering and in more recent versions adding the RC to the project does not always seem to be "detected" by the project until after you have then saved, closed and re-opened the project (e.g. I found this to be the case in XE4 but may also apply to other versions).
Also in some more recent versions, simply adding such a $R 'file.res' 'file.rc' declaration to the DPR causes the Project Manager to identify the referenced RC file as part of the project, but this does not seem to be the case in older versions. Again, part of the tinkering in this area it seems.
I would also note the XE4 is usually rock solid in terms of stability, but adding/removing RC files seemed to trigger an access violation when closing the IDE, though normal stability seemed to be restored when re-opening the IDE and project. i.e. it is adding/removing RC files that seems to cause a problem, not simply the fact of having the RC file in the project.
UPDATE: In recent versions of Delphi (Delphi 10.2 Berlin) you should include custom resources before {$R *.res} line, otherwise they will not be automatically compiled.
See an example here: "How do I make a PNG resource?".
I had the same problem and found out something new.
{$R glyphs.res glyphs.rc}
this is the code for compiling glyphs.rc to glyphs.res in the pre-build. (Works with Delphi XE4)
But this code ONLY works if it is in the *.dpr file! If you place this code, in a *.pas file as I did the first time, it will simply behave like {$R glyphs.res} and will not compile the RC file. Maybe this is a bug in Delphi.
I tried to do this in Delphi 2007 and it didn't work. I had put the line,
"{$R glyphs.res glyphs.rc}"
in my project file right above the "{$R *.res}" line that the IDE puts in there but when I added the rc file using the IDE, it put it above the "uses" line and then it worked.
I could not get rid from the mainicon in my application, so i made an trapgate.rc file put that file in the src directory, used:
MAINICON icon ".\Icon\MAINICON.ico"
5012 icon ".\Icon\5012.ico"
Then used BRCC32 to make from the RC a RES file, did the build and i had the correct icon.
you can also put more icons in there and switch thats why i added the line in makeres.bat
looks like this :
brcc32 folders.rc -fofolders.res
brcc32 main.rc -fomain.res
brcc32 xOutline.rc -foxOutline.res
brcc32 xSpin.rc -foxSpin.res
brcc32 credits.rc -focredits.res
brcc32 licence.rc -folicence.res
brcc32 trapgate.rc -fotrapgate.res <-- this is my icon file
So whatever you do even if you change the icon in the folder ..\icons of course be sure it has the correct name like mainicon.ico and 5012.ico
Hope that did help for does who can't change the icon in Delphi 7 itself.

LIB file output locations for Delphi 2009 packages

When building a Delphi 2009 component package, how do you specify which directory should contain the resulting .hpp and .lib files needed for C++ Builder users?
On the Project|Options|Delphi Compiler|Linking page, the first two items are C++Builder .hpp output directory and C++Buidler .obj output directory should do what you want. The .lib and .bpi files. However, it seems that there is a bit of a bug in how these options are passed to the compiler... I'll speak with the engineer responsible about it.
From the command-line DCC32 you can use the following to control where to place these items:
-N0<path> = unit .dcu output directory
-NH<path> = unit .hpp output directory
-NO<path> = unit .obj output directory
-NB<path> = unit .bpi output directory
Note that the -NB switch AFAICR, also controls where the .lib file goes as well.
There is a known bug: http://qc.embarcadero.com/wc/qcmain.aspx?d=67513
This is /expected/ to be fixed in the forthcoming Update 3. (Don't worry about the 10.0 resolved in build number, that is a mistake that will be corrected when Update 3 is released and all the bug fixes get synchronized back to QC)
As far as I know, you can't. None of the directory options seem to control it. However, you could probably define a post-build event (Project->Options->Build events) which would copy the files to where you wanted them.

Resources