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
Solved

Packages

Posted on 2002-06-27
8
725 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used.

791 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