Solved

Packages

Posted on 2002-06-27
8
732 Views
Last Modified: 2012-05-04
Using Delphi 6

I've developed a couple of packages that I want to use in a big system but I've run into the following error - "Cannt load package A. It contains unit xxxx which is also contained in package B"

No I've read the help and found the following under the Contains clause: " A unit cannot be contained(directly or indirectly) in more than one pakage used by the same application"

This doesn't make any sence to me. Isn't the whole idea to be able to reuse your code if possible. I know usually I would just have functions that I'd reuse but isn't that the idea of packages and units to.

Please help me out here
Fick
0
Comment
Question by:jfvd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 200 total points
ID: 7115303
Simply include package B in the 'requires' clause of the package A.
0
 

Author Comment

by:jfvd
ID: 7116330
I don't think that'll really work for my problem ... I've got units that's being used in package A and B and then both packages are used in an App for different functions.

I understand that I've got to make a "common" package that's used by both packages or something like that but I'm not sure.

What I need to do:
 A uses units x1, x2, y1, z1
 B uses units x1, y1, z2

The error I get is that x1, y1 is contained in A or B depending on which I try to execute first. Also some of the common packages has form that I need in both.

Hope this clears it up a bit.
 Fick
0
 

Author Comment

by:jfvd
ID: 7116454
I seem to have managed to get around the first problem but now I get the following error in my main app: "A class named TraTObjectRTTI already exists"

I've also got a little dummy program where I call the same to packages and I don't get the same error in there.

Please advise
 Thanx
  Fick
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jfvd
ID: 7116779
The error mentioned in the last post occurs on the following line:
 XferPck := LoadPackage('POSTransfers.bpl');

( XferPck : HModule)

What stumps me is that the same code works in a little dummy app I've put together.
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 7116967
> I don't think that'll really work for my problem

It was the correct answer to the original question. It's all documented in the help.

> "A class named TraTObjectRTTI already exists"

You're attempting to register the class twice.

In the original question you did not mention you're loading runtime packages dynamically.
I have created such a system and it worked without problems.

Sorry, I have no time for twenty questions.
Ask a question if you can. I will answer if I can.
Wish you good luck.
0
 

Author Comment

by:jfvd
ID: 7117164
Thanx

Is there any way to determine which class it is that I'm regestering twise?

0
 
LVL 8

Expert Comment

by:TOndrej
ID: 7117253
> "A class named TraTObjectRTTI already exists"
I guess it's TraTObjectRTTI in this case...
0
 

Author Comment

by:jfvd
ID: 7117264
Thanx

I got the culprit. It would seem that delphi just give the classes generic names if they're being loaded dynamicaly. In my instance it was called objMWXfer but as it was RTTI that was involved ... I don't know.

Thanx for your time though.
 Have good weekend.
  Fick
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question