Decompressing gzipped files in Delphi 2009 - delphi

Up until Delphi 2007 I was using DelphiZlib 0.2.99 for decompressing gzipped files. In Delphi 2009 the library does not compile anymore. Besides the conflict with Delphi's own zlib.pas unit, the code generates a number of string-related compiler errors and warnings which I don't think I can fix without a close understanding of the library code. DelphiZlib code was last modified in the year 2000, and it does not seem to have been updated since.
What can I replace it with for Delphi 2009? All I need is to decompress *.gz files. This is for a freeware project, so I strongly prefer free-with-source solutions, but I'll consider commercial libraries too.

Have a look at Abbrevia

Related

Which Delphi Version supports which object file format?

I am searching for a list of supported object file formats for each delphi version. Object files should be linked with something like: {$L lib/object.o}.
The Reason for this is a linker error in Delphi7 for a project i maintain. The error does not occur in compilers >XE3. I have only XE3 and above to test.
Has someone maintained a list or knows a reference to one where i can find informations about the supported format and/or changes with newer versions, maybe also problems with object files, etc?
I would like to help a user of the project with this problem (lz4-delphi issue).
The change came with XE2 which added support for the COFF object format. Prior versions only supported OMF objects.
The change to add support for COFF was driven by the new 64 bit compiler, introduced in XE2. Embarcadero did not have a 64 bit C++ compiler at that time and so needed to link objects produced by another compiler. They chose to use the MS compiler which emits COFF objects.
Allen Bauer's answer to a question that I asked contains more detail.
In practical terms this means that for Delphi 7 you will need to compile the source code with bcc32. Or compile the C code with some other compiler but then link to a DLL.
For future reference, Delphi 10.1 Berlin and 10.2 Tokyo both support ELF64 format, and also COFF.

How can I install my own copy of Indy10 from source, in Delphi XE4, if I get "not a valid win32 application" error?

Using the latest Indy10 sources from subversion, installing in to Delphi XE4,
I get this error when I try to install "dclIndyProtocols180.bpl":
Error:
Can't load package C:\dev\..\comp\Indy10\Lib\Output\BPI\Win32\Debug\dclIndyProtocols180.bpl.
%1 is not a valid Win32 application.
The BPI\Win32\Debug folder in question contains these files:
dclIndyCore180.bpl
dclIndyProtocols180.bpl
IndyCore180.bpi
IndyCore180.bpl
IndyProtocols180.bpi
IndyProtocols180.bpl
IndySystem180.bpi
IndySystem180.bpl
How do I fix or work around this? I am not exactly new to Indy, or Delphi, but each time there's a new delphi release, there are interesting surprises for those of us who prefer to build from source code and track subversion rather than using that random point in time which ships with the Delphi XE4 installer.
As a general side question: Is there any place where the status of the Indy project's subversion code, compared with whatever Embarcadero ships in their products is noted, or recorded?
By default a new package in Delphi might automatically be 64 bit, or you may have built a dependency as a 64 bit BPL, but not have switched to 32 bit for that BPL and rebuilt it.
Also you might have folders in your Library path that allow 32 bit and 64 bit BPls to try to load each other, causing this issue.

Delphis ZLib Interface not initialized

When working with Delphi XE2 I have the following problem:
When I try to compress a response from IdHTTPServer that should be sent to a client, I am not able to do this. The IdCompressorZLib.CompressHTTPDeflate or IdCompressorZLib.CompressStream functions always stop with the error ZLib Error (-6). This means that Delphi does not find a library with the expected version. ZLIB_VERSION is set to 1.2.5 in my environment.
My question is what I have to do to get it working?
OK, I've fired up XE2 and can reproduce what you report. It would seem that Embarcadero have blundered when building Indy for XE2. There is a mismatch between the zlib version of the linked objects, and the zlib version that is passed to the zlib initialization functions. Nothing you can do with what they shipped can work around that flaw.
Your options, as I see it:
Fix the version of Indy that was supplied with XE2. This will involve modifying the Indy source files and fixing the version mismatch. And then linking the modified Indy units to your application. Not impossible, but possibly a little awkward.
Use the latest version of Indy, obtained from the Indy project repo. You'll then have the latest and greatest Indy.
Use a different zlib library. For example the zlib library that ships with Delphi is known to work. I know you had trouble with this when I suggested it in a comment, but I for one have used it without trouble.
Use a different version of Delphi. Not a great option, but I'm including it for completeness.

Alternative to TXMLDocument?

Recently we upgraded our code from Delphi 2009 to Delphi XE and updated our Indy components (not sure if this is relevant).
But ever since then we have had errors on Windows Server 2003 machines when loading and saving XML files.
XMLDoc.LoadFromFile()
XMLDoc.SaveToFile()
The DLL msvcrt.dll is much smaller on Windows Server 2003 (300kb or so) compared to over 600kb on other operating systems... So its missing something in that file and its causing the error...
Does anyone know how to fix this? Or is there an alternative to TXMLDocument that I can try?
By default, TXMLDocument/IXMLDocument is just a wrapper around the MSXML COM interfaces when running on Windows platforms. Neither TXMLDocument nor Indy use the _ftol2_sse() function, or even link to msvcrt.dll. Something else in your project is at fault.
msvcrt.dll is (part of) the Microsoft Visual C++ Runtime. I think you got an older (or maybe even newer) version of this runtime that doesn't include this function.
Now you'll have to find out where this function is called. Do you link obj files with your project or use (other) 3rd party dll's?
To answer the last part ("is there an alternative?"), you might want to check out Jedi Code Library's TJclSimpleXML class. It does not require any external DLL, is quite fast, and is very easy to use. Besides, these days JCL and JVCL are a must-have anyway if you code in Delphi.
http://wiki.delphi-jedi.org/wiki/JEDI_Code_Library is their page I believe. I hear in seattle you can get it through IDEs integrated package manager.

Upgrading to HTMLHelpViewer in DELPHI XE (Can't find HTMLHelpViewer.pas)

I am upgrading from Delphi 6 to Delphi XE. In Delphi 6 I was using HTML help files (.chm) and used the StoHtmlHelp to make it so that I could call context sensitive help like we used to call .hlp files. I'm upgrading to Delphi XE so I need to use that native HTML help support.
I know I'm supposed to add HTMLHelpViewer to the uses clause of the project, but when I do I get a compiler warning that it couldn't find the file.
Could not compile used unit 'HTMLHelpViewer.pas'
Does anyone know why Delphi isn't finding this file by default? It should be built in.
Not being able to compile a file and not finding a file arent't the same thing. If Delphi is trying to compile HTMLHelpViewer.pas you must either:
have the vcl source folder(s) on your library path (not recommended), or
another HTMLHelpViewer.pas file is somewhere on your library path, that path comes before the standard Delphi lib folder, and that HTMLHelpViewer.pas file contains something that Delphi XE is not happy about.
The first is not likely and it would be very strange indeed if Delphi could not compile one of its units (apart from system.pas).
The second seems more likely... And if that unit used to compile, the complaints from Delphi XE could well be due to differences between Delphi 6 and Delphi XE.
You don't actually need to add it the uses clause of the .dpr file – you just need to use it from some unit in your project.
Having said that, you may actually prefer to add it to your .dpr file, and if so then do it like this:
uses
Forms,
HtmlHelpViewer,
MyUnit in 'MyUnit.pas',
I'm guessing that you have something like this:
uses
Forms,
HtmlHelpViewer in 'C:\Program Files\Borland\Delphi6\Source\VCL\HtmlHelpViewer.pas',
MyUnit in 'MyUnit.pas',
This will fail because you are asking XE to compile D6 source.
For RTL/VCL units its best to omit the path to the file and let the compiler find it (it knows where to look).

Resources