I have a bunch of procs and funcs that I intend to use for all my projects. Therefore, I created and installed a package (MyLib.bpl), with all those procs and funcs to act as a global library. Now, I want the editor to understand that when I write MyFunc (a, b, c) in a unit's code, that function is contained in MyLib. Do I have anyway to list in the uses clause all the .pas units where those procs and funcs are contained? There's a way to tell the editor that it must look out in MyLib to find MyFunc (a, b, c)? I'm pretty sure that I'm missing something, but I don't know what.
Asked
Active
Viewed 139 times
1 Answers
3
You still have to put the unit that contains MyFunc
in your uses clause. Using packages means that the code isn't included in every application, but the compiler and linker still have to know where in the package they can find MyFunc
.

Ken White
- 123,280
- 14
- 225
- 444
-
Thanks! I allready was suspicious about that issue. This is true also for custom components?. I mean, if I have a package with custom components, do I have to list the .pas of the source code in the uses section? What if I want to distribute that components, I have to distribute the source code together? – user2383818 Jun 02 '13 at 14:07
-
You have to add the units for components to the code as usual also, for the same reasons. You don't have to distribute source code, as long as you distribute the package and the .dcu files (for people not wanting to use packages). Note that most Delphi programmers will not buy components without source code, because that means that wnen a new version of Delphi is released, they can't use it until you give them a new set of .dcu files; distributing without source may limit your sales a lot. – Ken White Jun 02 '13 at 16:22