views:

48

answers:

3

I have a project in which i created a class called "validator".

i also created a DLL that has a function that i want to pass the validator class as a parameter. but the DLL doesn't know the class in my project cause it is a different DLL.

i also can't add a reference in the dll to the project because the project has already a reference to the DLL (can't make circular references).

how do i get the DLL to recognize the validator class?

A: 

does it have to be a parameter? Can't u just create a non-static method? If you really want to , sounds like you have to create another project and build a different class.( that's if you want to reference the method using dll)

rlee923
+2  A: 

Define an interface in the DLL, that has the needed functions (like bool Validate()).

Have the validator class implement the interface and give it to the DLL.

Timores
What do you mean in "Give it to the DLL" ? i think the problem with that solution is that if i change the interface in my project , i will have to cahnge it in the dll....
Rodniko
Give an instance of the validator class to the method in the DLL that expects the validator feature.
Timores
A: 

Sounds like you need 1) a redesign or 2) a refactoring effort that creates a third class library that can be used by both of your current DLLs.

Tim
a third DLL that both the Project and the DLL use, sounds Good :) thanks.
Rodniko