Solved

Packages

Posted on 2002-06-27
8
718 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
  • 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
 

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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now