jitendra gouda
jitendra gouda

Reputation: 7

which one is best for use in delphi i.e use of package or dll

I'd like to use a .dll with a delphi application, but I'm curious if a delphi package is more flexible than dll?

Upvotes: -1

Views: 526

Answers (3)

You can read this article on my Blog: "DLL's, BPL's Static and dynamic loading, and Packages in Runtime"; Is 's writed in Spanish but you can try the Automatic translation (on right part of the page).

Basically BPL is an extension of a DLL. It's a DLL with some things added.

(POSITIVE) If you use BPL's you can do more things with the DLL. More power. You can use RTTI (you must build your applicaction with runtime package for accesss RTTI).

(NEGATIVE) If you use BPL's with more powerfull, you can only use it with Delphi, no with other languages.

If you're sure that you only use it with Deplhi, I think that you must use BPL. Search samples about RTTI, RegisterClasses, GetClass method, LoadPackage (for dynamic load),...

Regards.

Escuse-me for my poor english. It's not my natural language.

Upvotes: 2

user160694
user160694

Reputation:

Packages are special DLLs that can export classes, while DLLs can only export functions. Yes, you can write a DLL function that creates and instance of a given class, but you can't use a class declared in a DLL (unless using some hacks maybe), while you can use a class declared in a package directly. Packages "know" about Delphi object architecture, while DLLs don't. On the other end, DLLs can be used from any language able to use them, while packages are Delphi-specific.

Upvotes: 0

TheBlastOne
TheBlastOne

Reputation: 4320

Not knowing excactly what you mean, and believing you are a newbie (so I may omit some specialized aspects), and implying you know what a DLL is:

The first and foremost reason to build a package is authoring a design-time component.

You can do quite everything (well..almost...) that a package does just as well with DLLs -- except for the design-time stuff.

Additionally, you can package multiple compiled packages into one Borland Package Library (BPL file) without having the design-time features in mind. If you think deploying and runtime-binding one BPL is better than various DLLs, go for it. The primary purpose is design-time support, though.

Upvotes: 1

Related Questions