Can SQLite library embed (Link) to Delphi executable file? - delphi

I am wondering if we able to embed SQlite library into Delphi executable file and we may deploy our application as single .exe file without any SQlite dll file.
The embed is not keep the sqlite dll file into resource but link to Delphi executable file.

I have not tried this component out, but I plan to in the future
Delphi Inspiration - DISQLite3
There is also
Synopse OpenSource SQLite3 Framework
A Freeware version is available too

We have compiled SQLite3 with Borland's free command line tools C compiler and the resulting OBJ file we linked in Delphi with {$LINK 'OBJS\sqlite3.obj'}, and written the pascal wrappers for the functions we needed.
There was a problem resolving some standard C library functions when linking but we re-implemented them in Delphi.

I had the same problem and this is the solution I came up with. Maybe it can help you. Just include sqlite3 and you then have direct access to the dll functions. I used the same methods that have already be outlined:
http://simvector.com/download/delphi_sqlite3.zip
The DLL is just encoded in source form and the DLLLoader unit loads it at runtime. The end result is no extra DLL in your distro at the expense of it all being loaded into memory at once vs parts loaded on demand via the OS.
We needed it to work as normal, yet no extra dll in distro. So works for our needs.

Anydac SQLite driver has statically linked SQLite engine. It is commercial library, although. They has an article about anydac and sqlite.

Delphi can link .obj files, thereby if you have them available (or source code to compile them), you can link them into an executable. But you can't to that with the SQLLite dll.
IIRC DISQLite 3 does exactly that, check it.

You can download the SQLite open source and compile it into any environment that can compile vanilla C code. It's not especially hard.

Related

Delphi XE3 App with ActiveX / COM objects

I'm a bit confused on something, being quite a while since I've used external controls. Basically, I'm writing a small test app with Delphi XE3 which uses an ActiveX control. A TLB file is generated as usual. I have tested on two machines (an Acer notebook and a Dell Latitude 10). When I test on my desktop Windows machine I get an error traceable to the OCX file. I was under the impression that the TLB.pas file was all that was needed to instantiate the control. Do I also need to install and register the OCX file ? Does COM component need to be distributed with its .DLL file ? TIA for your anticipated help.
Brian Corll
The type library only describes how to call the library. The .pas file generated from the type library also only describes how to call the library. That's all compile time. At run time when you actually call the library, you need the library to be registered and present.
So yes, you'll need to distribute and register the library.

Delphi unit for msctf.h header file (from Platform SDK)?

Is there any Delphi unit available corresponding msctf.h header file from Platform SDK?
I have checked Delphi 2010 source folder, but it seems Delphi doesn't come with that.
Thanks in advance for your time!
You can use Visual Studio's MIDL to generate a type library (.tlb) from the .idl file and then use Delphi's tlibimp.exe to generate the Delphi interface unit.
The problem with the original .idl is that it doesn't contain a library statement so I added it manually (otherwise MIDL wouldn't generate the .tlb).
See if the result helps you (you may still need to fix some parts by hand).

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).

how to use system.xml.dll in delphi

I downloaded the system.xml.dll, then added it to my Delphi code as following:
uses system.xml;
etc...
When I try to compile the project, the following message appears:
file not found system.xml.dcu.
Can anyone guide me how to solve this problem?
Thanks.
The uses clause in Delphi refers to Delphi units, either compiled in a *.dcu file or a *.pas source file that the compiler will use to generate the corresponding *.dcu that is needed.
You cannot just reference the DLL itself.
To use your DLL, you would need at least a unit that would expose in a Pascal way the DLL interface or parts of it.
It can be the Pascal translation of a C header file or just declaring some external routines from the dll to load statically with your program...
What you probably need to reference to work with XML in Delphi are XMLIntf and maybe xmldom.
Have you looked at what the XML Data binding wizard or the XML Mapper Tool can do for you?
Note: I assumed you were working with Delphi Win32. And AFAIK system.xml.dll is part of the .NET world.
If you are using Delphi for .Net you need to add a reference to the system.xml.dll assembly to your project.
If you are using Delphi (Win32), then in order to be able to use .NET assemblies (DLLs), you have the option of using COM interfaces. Follow below steps:
Open the project you want to use it in.
Use Component menu.
Select "Import Type Library"
Select the DLL you want to use.
Follow the next steps as given by wizard.
This will generate a source file which is essentially a wrapper. You can call function of that wrapper as you need.
Please note that using above method will mean that .NET framework must be present on the computer running your application.

How do I compress multiple files into a single archive with Delphi

I need to compress multiple files into a single archive using Delphi. I'd prefer to use freeware components or open-source components because I am very very cheap :-)
My primary requirements are:
Possible to encrypt the archive
Can create common archives that can be opened by anyone with a copy of WinZip
Does anyone have suggestions with components that they have used? Please feel free to suggest free as well as commercial components/libraries.
Perhaps DelphiZip is what you are looking for, it seems to support encryption, too, and is WinZip compatible. It is released under LGPL.
KaZip is an open-source ZIP archiver. Here is its description:
KAZIP is fast, simple ZIP archiver and
dearchiver which uses most popular ZIP
format.Inflate - Deflate zip
compression format (no encryption
support and no multidisk
support).KAZip is totaly based on
Delphi VCL - no DLL, ActiveX or other
external libraries.KAZip is totaly
stream oriented so you can deal with
data only in memory without creating
temporary files, etc. If you need to
add zip-unzip functionality to your
application,KAZIP is the right
solution. Additional ZipListView and
ZipTreeView components for easy
visualisation.Functionality:Zip-Unzip
using Inflate-DeflateBZip2 unzipping
trough usage of BZIP2 units from
Edison Mera Menndez.Functions:Adding
Files, Folders, Streams; Selecting,
Deselecting, Checking;Extracting to
files and streams;Delete and Rename
filesCreate, Delete and Rename
foldersTest, RepairMany new properties
and methods, improved speed.A very
complex Zip Browser demo application
is included
It is not compatible with Delphi 2009 yet, but with some minor changes in the source code, you can make it work in Delphi 2009 too. Actually, that's what I did.
Regards
I`m using madZip from madCollection
I'm surprised no-one has mentioned JclCompression yet - it's part of the well-known Jedi Code Library (JCL).
Here's a view of the unit itself : http://jcl.svn.sourceforge.net/viewvc/jcl/trunk/jcl/source/common/JclCompression.pas?view=markup
Note, it's compatible with 7-zip DLL version 4.64 - newer versions might not be backwards-compatible...
I recommend the $69 ZipForge from ComponentAce.
You could use 7zip (LZMA) bindings for Pascal (compatible with Delphi): http://www.birtles.org.uk/programming/
Another Delphi resource to look at would be InnoSetup. The source code is available and with a little work might give you an edge up on what your trying to do. There is an option to create self extracting zip archives which are compatible with WinZip,
My thoughts are not to use the program, but to use his source as a starting point since it is very heavily tested and extremely solid.
There are infozips zip32 and unzip32 dlls. They can be used from Delphi (even from Visual Basic), there are interface units/modules for both. The interface isn't as good as I would have liked it, but it works.

Resources