Arsnow
Arsnow

Reputation: 161

Using package in a project

I created a package with components ( a runtime package, and a design package) in delphi 10.1 Berlin.

I want to use components of this package in a vcl project.

I want the code of the components being embedded in the project. (I don’t want to link the project to an extern bpl)

Each time I compile the project, Delphi tells that sources of the components are not found. I could add the directory of the components sources in the path of the project, but I don’t want do that. Since the code of the component is in the bpl, I guess there must be a solution for Delphi to "bind" the bpl to the project without knowing where are the .pas or the .dcu of the components, but I can’t figure how to do that. Is it possible ? how ?

Upvotes: 1

Views: 2556

Answers (2)

David Heffernan
David Heffernan

Reputation: 613461

As I read what you have written, it seems that you do not actually want to use packages in your executable. That is what I infer from this statement:

I don’t want to link the project to an extern bpl.

So you need to link the source code into the project. There are a variety of ways:

  1. Include the source files (.pas and any auxiliary files) in the executable project.
  2. Add to the project search path the directories containing the source files.
  3. Add to the project search path the directory containing the compiled .dcu files.

Which you choose to do is entirely up to you.

Note that you should also make sure that the Use runtime packages project option is not checked for your executable project.

Now, I appreciate that in the question you state that you don't want to do what I am advising you to do. Rather you would prefer to somehow embed the package into the executable. But that's not what how packages are designed. If you wish to include everything in the executable then you do just that.

Upvotes: 6

whosrdaddy
whosrdaddy

Reputation: 11860

Delphi needs to know where the source files (.pas or .dcu) of your component are. You must add the source folder to the library path (found under Tools - Options - Delphi Options - Library)

Upvotes: 1

Related Questions