Link to home
Start Free TrialLog in
Avatar of bjqrn
bjqrn

asked on

URGENT Circular dependency problem

Ok, I have two libraries:

corelib
netlib

Corelib contains a function called 'InterpretCommand', which needs to be accessible through 'netlib'.

'InterpretCommand' on the other hand needs access to a class in 'netlib', 'ClientSocket'. Therefore 'netlib' and 'corelib'.

Referencing 'netlib' in 'corelib' works good, but when I try to reference 'netlib' in 'corelib' it tells me it's not possible since it would create circular dependencies.

Any solution?
ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bjqrn
bjqrn

ASKER

Could you explain the "new library" part a bit further?
ClientSocket class must be moved to new library. Create new library project and move this class to it. Let's call it socketlib.
Dependency:
netlib calls InterpretCommand from corelib
corelib calls ClientSocket from socketlib.

References:
netlib project - corelib
corelib project - socketlib.

If ClientSocket is used directly by netlib, this is OK and doesn't create circular dependency. socketlib must conrain low level classes and functions used by high level netlib and corelib.