2
votes

Can we use dcu an runtime like dll? For example, show form that compiled in dcu file. I have the question because i want to develop plugginable application. As Delphi programmer, as far as i know, i just have two options to do this, dll based or bpl based. I like dll based because it does not depend to delphi version, but.. save form to few dll, make each dll have a big size and its total size is bigger than single .exe extremely. Using bpl, it depends on Delphi version that compiled both bpl and exe.

Or can somebody explain a trick or strategy so can make .dll that save form become as small as possible? Thanks!

3
DCUs are version dependent too, so wouldn't gain anything.Uli Gerhardt
DLLs are what you want, but you should avoid using the VCL in the DLL. Your program should expose the VCL capability that you would like the plugins to call and expose it via interfaces. Loads of boilerplate, but it gets away from BPL hell.David Heffernan
You can use dlls compiled with run-time packages.Torbins
Loads of boilerplate and glitches after compiler type changes like ambiguos nature of char, PChar and string. To use DLL and interfacrees one should rely on datatypes standardized in COM, even if not using COM infrastructure itself.Arioch 'The
@Torbins that makes the dll version dependant also.Toby Allen

3 Answers

3
votes

No you can't directly access DCU files from runtime :(

It was pretty common practive to store Delphi forms in DLLs, Google should be able to throw up quite a few examples.

Delphi Dll - more than one Form / unit in one dll

http://www.link-rank.com/dll.htm

http://en.allexperts.com/q/Delphi-1595/2008/6/Call-procedure-DLL-Form.htm

http://www.blitzbasic.com/Community/posts.php?topic=54261

HTH

1
votes

As far as I know, you cannot access .dcu-s at runtime. Better use DLLs.

1
votes

DCU's are only compiled units (hence the name) they are used to build an exe/dll through the Linker.