tags:

views:

275

answers:

4

I have a Delphi DLL that houses a form which uses a variety of third party components. This DLL is used by many different versions of Delphi. I compile the third party components into the DLL. I believe I still need to link to some "base" Delphi packages like rtl, vcl, etc, so my DLL will use the same memory manager and other global resources that the Delphi IDE is using. How do I find out what BPLs I need to link to?

Ideally I'd like to point some utility at my DLL or project and have it list every BPL that it would depend on if I was only using BPL's and had no source files available. Then I could view that list and pick the packages I want to load at runtime. The current list given in the project properties under "Runtime Packages" is incomplete (as it has been tweaked over the years).

+3  A: 

Check the "Build with Runtime Packages", leaving the whole list of packages the way it is.

Do a Project|Build (not compile!). After the build completes, use Project|View Information on ; the resulting dialog will give you a list of the actual packages you need to distribute.

After Jeremy's comment about the default list of packages being empty when he enables building with packages, here's the list from that options dialog from Delphi 2010:

   vclx;vcl;vclimg;dbrtl;Rave77VCL;bdertl;rtl;vclactnband;xmlrtl;
   vcldb;vcldbx;vcltouch;dsnap;dsnapcon;TeeUI;TeeDB;Tee;vclib;
   ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;
   intrawebdb_100_140;Intraweb_100_140;VclSmp;vclie;inetdb;
   webdsnap;websnap;inetdbbde;inetdbxpress;soaprtl;vclribbon;
   DbxCommonDriver;DbxClientDriver;DBXInterBaseDriver;DBXMySQLDriver;
   dbexpress;dbxcds;SynEdit_R2009
Ken White
This shows the statically linked packages, but if you load one at run time, there is no way to get this information with any static analysis tool
Robert Love
Hi Ken, thanks for the reply. I'm using Delphi 2010. There isn't a Project|View Information menu item, only the OK button to close the build dialog. Also note my comment that the current list of runtime packages is incomplete (right now it just has vcl in the list).
Jeremy Mullin
@Jeremy: Yes, there is. It's in the Project menu and enabled after build. It appears they've changed the menu text slightly, however, to "Information for <YourProject>" on that menu. To clarify, it's *not* in the build dialog; it's on the IDE's main project menu after you close the build dialog.
Ken White
@Robert: You're correct, but that wasn't the original question. :-)
Ken White
Thanks Ken, it's working now, thanks! I'm assuming with this architecture I need to have ShareMem as the first unit referenced in my DLL, does that sound correct? I'm passing string references between my Delphi design time package and this DLL.
Jeremy Mullin
@Jeremy: Yes, to pass strings between them you'll still need ShareMem. Or you could use the PChar and size methodology that the WinAPI uses. (Also didn't notice the SynEdit_R2009 package in the list I posted before; I'd forgotten I'd installed it, and was thinking it was a clean install of D2010. Sorry about that.)
Ken White
+7  A: 

Check a tool I wrote called "Required" - you can download from http://www.drbob42.com/tools

Bob Swart
Thanks Bob. I got the info I needed from the IDE via the "Project -> Information for <Project>" menu, but I tried your utility and it worked too. :)
Jeremy Mullin
Hey, good to see you on here!
Mason Wheeler
A: 

"This DLL is used by many different versions of Delphi."

Do you mean that you have programs written with Delphi 7 and other programs written with Delphi 2007 etc. that use the same precompiled DLL?

In that case you cannot use any packages to share object types and memory between program and DLL because they will use different versions of the packages wich are not compatible.

dummzeuch
The DLL contains property editors used by different versions of Delphi. My Delphi design time package calls into the DLL. I don't pass object types between the design time package and the DLL, only "basic" types like strings, integers, etc. I believe because I am passing strings I need to use ShareMem.
Jeremy Mullin
If you're passing strings, then yes, you'll need to use ShareMem. Then there's the question of whether the IDE also uses ShareMem. If it doesn't, then you can't pass strings. Pass PAnsiChar or PWideChar instead.
Rob Kennedy
+1  A: 
Neftalí