DLL Reference Problem

D

Don

I've got a problem with two DLLs that are referencing each other. Here is
the breakdown of the problem (the identifiers I use are not the real ones):

1. DLL-One declares a Class-X.

2. DLL-Two has a public method that has a parameter of Class-X (reference to
DLL-One required).

3. DLL-One calls the public method from DLL-Two, passing it an instance of
Class-X (reference to DLL-Two required).

4. VB Gives me an error in DLL-One stating "Reference required to assembly
'DLL-One' containing the type 'Class-X'. Add one to your project.

This makes no sense because Class-X is declared in DLL-One. Why is VB
telling DLL-One that it needs a reference to itself? Aside from creating a
new DLL to store Class-X or merging everything into one DLL, how can I fix
this? I don't even understand why I'm getting the error. Any help would be
greatly appreciated.

- Don
 
J

Jeremy

Don said:
I've got a problem with two DLLs that are referencing each other. Here is
the breakdown of the problem (the identifiers I use are not the real ones):

1. DLL-One declares a Class-X.

2. DLL-Two has a public method that has a parameter of Class-X (reference to
DLL-One required).

3. DLL-One calls the public method from DLL-Two, passing it an instance of
Class-X (reference to DLL-Two required).

4. VB Gives me an error in DLL-One stating "Reference required to assembly
'DLL-One' containing the type 'Class-X'. Add one to your project.

This is a cyclic reference, and although .NET will take care of it for you,
it is a huge sign you should need to consider rethinking your design. The
fact that the two DLLs are inseperable, means that you should just combine
them into one DLL, or seperate out the cyclic dependancies, and put them
into a single DLL together.

If you do this, it will improve the overall quality or your design, and it's
almost certain to fix the error.

HTH,
Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top