I would like to use the lib https://sourceforge.net/p/zbar/news/2012/03/zbar-android-sdk-version-01-released/ with delphi XE5, but the lib and. Jar and. So, You can use it with delphi XE5, how do? I need to read the barcode on my webcam!
Take a look at Using a Custom Set of Java Libraries In Your RAD Studio Android Apps. I understand that there was a lack of information on this topic in 2013, but now it is described in the documentation.
There are two different approaches that you can follow to add your Java libraries to your application for Android:
Use the Project Manager to add your Java libraries to your application. This is the simplest approach, you only need a couple of clicks. This approach should work for most people.
Create and deploy a classes.dex file manually. This approach allows you not only to add libraries to your application, but also to modify the built-in RAD Studio Java libraries for Android, or remove those that you do not need.
Add a Java Library File (.jar) Using the Project Manager (XE7 Way)
In the Project Manager, extend the Target Platforms node of your project. Within the Target Platforms node, extend the Android node.
Right-click the Libraries node and select Add.
In the dialog box that opens, select the .jar file that you want to add to your application for Android, and select Open.
Now the Project Manager displays your custom Java library under the Libraries node.
You can now use your Java library.
Remember to create a native bridge file for your Java library if you do not have one yet.
Create and deploy a classes.dex file from JARs manually (Old Way)
Once you have determined which JAR files your Android applications need, you can create a classes.dex file from them.
To create a classes.dex file, you need to use the command-line tool dx. You can find this command-line tool at C:\Path\To\Embarcadero\Studio\Version\PlatformSDK\adt-bundle-windows-x86-20131030\sdk.
Run dx with the --dex parameter, the --output parameter with the output path of the classes.dex file as its argument, and a space-separated list of paths to the JAR files that you want to include in the generated classes.dex file. For example:
dx --dex --output="classes.dex" "C:\Path\To\Library1.jar" "C:\Path\To\Library2.jar"
Note: You should create both a debug and a release version of your classes.dex file. The RAD Studio debugging features are only
available if the deployed classes.dex file contains the debug
versions of the included RAD Studio built-in Java libraries.
Deploying the `classes.dex` File
Warning: Follow these steps carefully. Android applications must always include a valid classes.dex file.
To configure your Android application to be deployed with your custom classes.dex file:
Select 'Project > Deployment' to open the Deployment Manager.
Uncheck the checkbox of the default classes.dex file.
Click the Add Files button and add your custom classes.dex file to the list of deployment files.
Change the Remote Path of your new entry to classes\.
Change the Platforms of your new entry to Android only.
See Troubleshooting in case if your app does not start after manipulations with the classes.dex file.
There is a library for Delphi XE7 for reading/scanning barcodes. This library was released in 2015 and is actively supported.
ZXing.Delphi - barcode scanning object Pascal library for Delphi XE7-Berlin.
So now if you want to read the barcode on a webcam, you don't need to tinker with .jar / .so files.
Related
I'm trying to use a static library in my C++ Builder project. The lib is created by using DCC32 to compile Delphi source code with -JL option. My Delphi source code is design as a "Designtime and runtime" package, which mean s all the code is built into one package. I want to know how can I use this static library in our C++ Builder project? Thanks in advance.
As David said, the Delphi compiler can't create static lib files at all. What you are trying to link to is an import library for a designtime/runtime package.
Delphi (and C++Builder) packages are not static libs, they are DLLs with a lot of extra information onboard, which makes it easy for Delphi and C++Builder code to link to them and the types inside. They are more or less equivalent to C# assemblies (guess where the C# people got the idea ;-).
To use such a package, in case you really want to use them, select the "build with packages" option from the project options and select this package too.
But if you want to create a single, standalone application, you don't build with packages and the Pascal files get linked into your application as if they came from a static library. But instead of specifying one lib file, you simply specify the .pas files in the project manager, i.e. you simply add the bunch of .pas (or .obj) files to your application directly.
The project will take care of compiling the Pascal files and linking them to your application.
Note that to install components into the IDE, you need a design time package (and that might link to a runtime package). But you don't need packages for your application.
These are some steps for your consideration:
Use -JP to generate obj files
Add these obj files in link step into your ilink32 command
If you use IDE and do not which ilink32 params then you may consider procexp or procmon to see these params.
I want to compile my program with 'Link with runtime packages'.
It tells me that I need some DB-related packages. But I don't use DB in my program.
How do I figure out which BPLs are needed?
There is some kind of dependencies viewer?
I expect there are more sophisticated/user-friendly dependency viewers available, but you can use the TDump.Exe utility that comes with Delphi to do this. E.g. from the CMD line in the containing folder
tdump dbgrids2.bpl > dump.txt & notepad dump.txt
then search for entries in the imports section of the result.
Another good tool if you use GExperts (RAD Studio IDE Expert) is the "PE information" included in this tools. Inside the IDE you can obtain the dependencies (BPL's and DLL's) of an EXE/BPL/DLL. And other information about the necessary pachages.
If you select and EXE on this tool, you can obtain a result like this:
How I 'solved' the problem:
Link with runtime packages:
In 'Project Options' I put all BPIs in 'Packages->Runtime packages->Runtime package import libraries'. BCB will only link the PBLs that are actually needed.
The BPI must ALSO be added to the project (just drag and drop it in the ProjectManager).
Distribution:
When you place a new control on your form, that resides on a different BPL, you need to add that BPL also to your distribution package. If you forget to distribute your BPL, the program will crash and burn. So, testing is easy. Just run the application.
Dependency viewer
As dependency viewer I used 'Project info' but that is limited. Process Explorer is way better.
That's it. I made a test and it works great.
Link: http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Loading_Packages_in_an_Application
I am helping a coworker set up his computer so that his Delphi 7 environment works like mine. He has Delphi 7 installed plus the third party tools we use. We have a Delphi app with source. It compiles fine on my computer but when he compiles it on his computer, it keeps coming up with 'file not found' errors for many dcu files. These are dcu files of third party components, either which come with Delphi IDE or have been installed manually.
I renamed his C:\Program Files (x86)\Borland folder and copied my whole Borland folder structure to his so that he has what I have. So now his Delphi IDE and the app structure resembles mine, yet he still gets missing dcu's. Every time he gets a missing dcu, he adds its path to Delphi's 'Search path' list. For some dcu's, they exist in different folders which means we have to troubleshoot further to make sure we picked the correct version. My 'Search Path' is empty as shown below which tells me my Delphi doesn't use this entry to search for dcu's. Our computer's PATH environment variable entry has the same values for anything related to Delphi.
My question is why my delphi app compiles fine as it finds all the dcu's it needs which reside in different folders yet his Delphi is not finding them when we have the same folder structure and PATH?
How does the Delphi IDE finds all the dcu's it needs during compilation? What is left now to look at is the registry. Are the search patterns in the registry? Where? (We also have Delphi XE installed if this means anything)
You don't want to add these directories to your project's search path. That will make it so that only this project is able to use these components. Instead, you need to do this in the global library path, which applies for all projects. Check the library path of your existing installation, surely you'll find a large list of directories here.
Main Menu -> Tools -> Environment options dialog -> Library page -> Library Path edit box
They are the output paths, try looking in the following location
Tools > Options > Environment Options > delphi Options > Paths and Directories
This tells the IDE what source files to include. The only other difference can be if you system variables are different if you have any.
http://docwiki.embarcadero.com/RADStudio/XE8/en/Library
Are there any components or 3rd party software to create the self-installer Delphi application?
I want to make some kind of one-click installer which will copy the main exe file and few other files to AppData folder and create the shortcuts. It should contain only one installation screen with few settings.
I just can't find any installation builder which will create such one-click installer.
Guess I have to store all my additional files (including uninstaller) as the resources inside of the single exe, and then unpack them into the destination folder. Maybe you know some more effective method?
Use InnoSetup. This can be configured/scripted to do automatic installations and does not cost anything.
Use NSIS installer (Nullsoft (winamp) installer.
It is very simple and configureable.
http://nsis.sourceforge.net/Main_Page
How to set "Directories/Conditionals" in Project Options and "Library" path in Environment Options? Delphi help don't say much about these very important settings. I have all kind of strange errors because of wrong dependencies between my VCLs.
1.
I have merged a large set of 3rd party controls in a package called ThirdPartyPackages_D7.dpk. This is useful when I reinstall Delphi because I don't have to reinstall all those 3rd party VCLs amnually.
Then, I have my own controls in MyControls_D7.dpk which depends on the ThirdPartyPackages VCL. I also have another package BlgPackage.dpk that depends on MyControls.
At the end of the chain is my application (DPR project) which is using the controls in BlgPackage.
ThirdPartyPackages.dpk -> MyControls.dpk -> BlgPackage.dpk -> MyApplication.dpr
When I change/edit something to the second package (MyControls.dpk) and build the DPR application, it works. The compiler sees the changes made into that package.
However, if I close the project and load and compile the BlgPackage, it throws a nasty message that function xyz cannot be found in MyControls because I delete it (I have loaded MyControls' units into IDE in parallel with application's units). It seems that building the application only refreshes the DCU files for all used packages but not the DCP/BLP files.
How do I write and compile the code in the packages without explicitly loading the packages into the IDE and building them?
(Note: I have a nasty bug that does not allow me to switch between projects without restarting the IDE or to load a group of projects/packages (*.bpg) at the same time.)
2.
Another problem is that I want to store the compiled files (DCP/BPL/DCU) of a package in its folder (for example c:\MyProjects\Blg).
If I set the "Output directory", "Unit output directory" and "DCP output directory" boxes of BlgPackage package to its folder, not only its BPL/DCU/DCP files will be stored there but also the BPL/DCP files of MyControls will be stored there.
How can I have the binary files of each package in a separate folder?
Delphi 7, Win XP, all projects set to "Rebuild as needed"
You should explicitely compile packages - just compiling package files is not enough and as you have noticed leads to problems.
In modern Delphi versions you can create a project group (not sure about Delphi 7) that contains an application and packages you want to develop with the application, and you can easily switch between them and complile packages without need to close/reopen the application.
BlgPackage should not have an access to MyControls package sources (through "Library" path or by using the same directory), it should access only already compiled MyControls package, else the files from MyControls are compiled every time you build BlgPackage and the compiled files are stored in BlgControls DCU directory
ADDED
The "Library" path should lead to compiled files (.dcp, .dcu) and (if needed) resource files (.res, .dfm) only - it is enough to compile applications and packages that requires "MyControls" package. You can set the directory for compiled files directly in the package settings, and you should copy the resource files (if you need them) to the same directory manually. This directory should be included into "Library" path, or else you can use a directory already contained in "Library" path.
The "Library" path should not lead to source files (.pas) if you don't want these files to be compiled every time you build your BlgPackage or an application that requires "MyControls" package.
I use much simpler way for 3rd partie components and reinstalling Delphi.
Open regedit and find
[HKEY_LOCAL_MACHINE/SOFTWARE/Borland/Delphi/xxx] where xxx is version and export whole
branch.
Open file and delete keys LMKEY, LMLIC.
Copy C:\Program Files\Borland\Delphi x\Projects\Bpl folder to another location
Copy C:\Program Files\Borland\Delphi x\Imports to another location
Reinstall Delphi including any updates and GExpert
Import previously saved registries
Restore Bpl And Imports Folder
And whoala, Delphi is back with all 3rd partie components and IDE settings. Only limitation is that all components must reside in same folder before and after reinstalling Delphi.
This also restores TeamSource settings. If you are reinstalling Windows as well, be sure to make windows user with same user name as before.
MY solution (kinda dirty, but hey it works):
I put ALL 3rd party libraries.controls in a single package (a super-package). I put all my controls in a single package.
Now, when I migrate the packages to a different PC all I have to do is to copy/paste two folders and set two paths.
Works for me - others may not agree with it and I can't blame them. I blame the 'hell designers' from Borland/Embarcadero. If you look on StackOverflow you will see that until now nobody provided an elegant solution to this.