-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
Delphi To/From
To/FromCODEGuides
Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

April Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi News / Other Topic   Print This     

making functions available between units

making functions available between units in Delphi News / Other topic (part of our Pascal and Delphi Coding group).

Quick Search: functions   available   between   making functions   making functions available   between units  
C.Oberhaus
Grass Valley, CA USA
Hi there

I have a unit which defines several wrapper objects to direct3D functions. This unit has (amongst others) the units 'directXGraphics' and 'd3dx8' in its uses clause.

These units also contain several functions, objects, records etc (such as TD3DXVector) which are useful for the user.

How do I make the objects,functions such as TD3DXVector etc available within a unit which ONLY has my unit in its uses clause? I don't want the user to have to also add 'directXGraphics' and 'd3dx8' to the uses clause too.

I also don't want to have to define wrappers with different names such as:
type TmyD3DXVector = TD3DXVector;

Thanks in advance
Peter
 Posted 24 years ago (Thread Starter)
Comment Quote
About C.Oberhaus
Visit Profile
Approved member.
Member subscribes to this thread but email is NOT VERIFIED.
About C.Oberhaus

Carol worked for Prestwood Software from 2000 through 2005 as Vice President of Sales and Marketing.


Post ID #8608, 5 replies
Thread Started 12/11/2002 8:03:00 PM
View Counter=4152
Last Reply Posted 12/22/2002 10:43:00 AM)
Location=Grass Valley, CA USA 
Joined=24 years ago   MB Posts=90   KB Posts=6  
C.Oberhaus
Grass Valley, CA USA
In case anyones interested, the solution:

unit SingleUnit;

interface

uses Unit1, Unit2, Unit3;

type
TFirstClass = Unit1.TFirstClass;
TSecondClass = Unit2.TSecondClass;
TThirdClass = Unit2.TThirdClass;
TFourthClass = Unit3.TFourthClass;

Now any unit that includes 'singleUnit' will have access to all duplicated classes from child units.(thx to Workshop_Alex,
Old UBB Archived Link: [URL=http://www.experts-exchange.com)]www.experts-exchange.com)[/URL]
 Posted 24 years ago (Thread Starter)
Comment Quote
About C.Oberhaus
Visit Profile
Approved member.
Member subscribes to this thread but email is NOT VERIFIED.
About C.Oberhaus

Carol worked for Prestwood Software from 2000 through 2005 as Vice President of Sales and Marketing.


Post ID #8658 (Level 1.1)  Reply to 8608
Thread Started 12/16/2002 12:12:00 PM
View Counter=2
Location=Grass Valley, CA USA 
Joined=24 years ago   MB Posts=90   KB Posts=6  
C.Oberhaus
Grass Valley, CA USA
rats, is there another way then?
 Posted 24 years ago (Thread Starter)
Comment Quote
About C.Oberhaus
Visit Profile
Approved member.
Member subscribes to this thread but email is NOT VERIFIED.
About C.Oberhaus

Carol worked for Prestwood Software from 2000 through 2005 as Vice President of Sales and Marketing.


Post ID #8702 (Level 1.2)  Reply to 8608
Reply Posted 12/18/2002 4:06:00 PM
Location=Grass Valley, CA USA 
Joined=24 years ago   MB Posts=90   KB Posts=6  
Most Recent Post
C.Oberhaus
Grass Valley, CA USA
:) Thats fine

Thanks for your help on that!
 Posted 24 years ago (Thread Starter)
Comment Quote
About C.Oberhaus
Visit Profile
Approved member.
Member subscribes to this thread but email is NOT VERIFIED.
About C.Oberhaus

Carol worked for Prestwood Software from 2000 through 2005 as Vice President of Sales and Marketing.


Post ID #8745 (Level 1.3)  Reply to 8608
Reply Posted 12/22/2002 10:43:00 AM
Location=Grass Valley, CA USA 
Joined=24 years ago   MB Posts=90   KB Posts=6  
Larry Drews
Iowa
pea,

In case anyones interested, the solution:

unit SingleUnit;

interface

uses Unit1, Unit2, Unit3;

type
TFirstClass = Unit1.TFirstClass;
TSecondClass = Unit2.TSecondClass;
TThirdClass = Unit2.TThirdClass;
TFourthClass = Unit3.TFourthClass;

Now any unit that includes 'singleUnit' will have access to all duplicated classes from child units.(thx to Workshop_Alex,
Old UBB Archived Link: [URL=http://www.experts-exchange.com)]www.experts-exchange.com)[/URL]

Be carefull! SingleUnit.TFirstClass is not the same class as Unit1.TFirstClass but rather a descendent class. So unless you use the SingleUnit types to declare your objects, the other units will have to do typecasting in some instances.
 Posted 24 years ago
Comment Quote
About Larry Drews
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Larry Drews
Veteran software developer specializing in Delphi/Kylix development. Currently Manager of Applications Development for a biotech company in Iowa.

Post ID #8659 (Level 1.4)  Reply to 8608
Reply Posted 12/16/2002 2:06:00 PM
Location=Iowa  
Joined=24 years ago   MB Posts=67   KB Comments=1  
Larry Drews
Iowa
pea,

Rats myself! I jumped in too quick with my last reply. The solution you gave does work. What I was thinking of was:

type
TFirstClass = type Unit1.TFirstClass;

This latter structure defines a new type. The structure that you gave simply defines an alias.

Sorry about that. I will try to take a little more care next time.
 Posted 24 years ago
Comment Quote
About Larry Drews
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Larry Drews
Veteran software developer specializing in Delphi/Kylix development. Currently Manager of Applications Development for a biotech company in Iowa.

Post ID #8720 (Level 1.5)  Reply to 8608
Reply Posted 12/19/2002 9:25:00 AM
Location=Iowa  
Joined=24 years ago   MB Posts=67   KB Comments=1  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1213A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #8608 Counter
4152
Since 4/2/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site: 
www.prestwood.com


©1995-2026 Prestwood IT Solutions.   [Security & Privacy]