views:

758

answers:

4

Hello.

The situation is the following. Typically I use RAD Studio 2010 for Delphi development. I have some components I would like to redistribute in binary form (*.bpl without source). But I would like people to be able to use them despite of their Delphi version. But, for example, dcu files can be used only by compiler version, which generated them. Almost the same situation is with bpl files as I know. Every bpl file will require corresponding VCLXX.bpl library depending on Delphi version. How do I make my bpls, compiled in 2010 to be able to be used in Delphi7, 2007 etc?

Is the only solution to have ALL Delphi versions installed and compile bpl files separately in each?

+6  A: 

Yes, that's the only solution. Each compiler produces DCUs and BPLs specific to it's own version. The only exception I'm aware of is that Delphi 2006 and 2007 share the same format.

Mason Wheeler
To elaborate on this - component vendors that ship only binaries tend to package them into an installer that contains ALL of the supported binaries and then installs the ones that the user selects.
Remy Lebeau - TeamB
+2  A: 

To distribute compiled code that can be used by multiple compiler versions, distribute an ordinary DLL, not a BPL. Packages and units are version-specific.

Create standalone functions that you export in the C style, or create COM objects that get registered with the OS.

It doesn't have to change your entire development strategy, though; it could be a DLL that uses the BPL, so you can keep all the work you've already put into the package.

Rob Kennedy
Unfortunately, this will require an application of my user to include my dll libraries. I don't think regular user will be glad to redistribute them.
FractalizeR
That's what they'd have to do if your original plan — a BPL — were viable. There's no difference in that regard. (Although I hear there are ways to bundle a DLL within an EXE, for those people who really care how many files they distribute.)
Rob Kennedy
Delphi can take code from BPL and integrate it into target EXE. There is no need to redistribute BPL separately.
FractalizeR
No, Delphi can't do that. Perhaps you're thinking of the DCP file, which, as I understand it, is essentially a collection of all the DCU files that went into a package. But that file is only used when packages are being used, so you'd still need the BPL file.
Rob Kennedy
A: 

I can create an installer that get the the installed Delphi versions on machine. Choose for witch Delphi you want to create de bpl and call the correspondent Dcc by command line to generate the correspondents bpl and install in Delphi. You can look in JVCL installer to get as example.

Att.

SaCi
Maybe you didn't read this in original @FractalizeR message"I have some components I would like to redistribute in binary form (*.bpl without source)."Or maybe I don't get how you plan to call the correspondent DCC to generate the bpl without source code.
jachguate
@SaCi, JVCL is redistributes in source form and is compiled to binary on target developer PC. So, this is not my case.
FractalizeR
A: 

You could create an obj file in c++ builder and link that in Delphi, distribute a small pas file (header). The c++ builder obj format hasn'tchanged from delphi 7 to 2009 (I can confirm 2010 but I think it will be the same as well).

You would need to test though if this would be possible for visual/designtime components.

Remko