1

I have two dll modules. Module A and B. "A" call's function "B". And "B" calls function "A" to place result. "B" dependes from "A", "A" depends from "B". When i compiling (clean) project - i have a problem. (I have to remove module dependency - comment some lines - compiling "A" -then "B" then uncomment lines, add dependency and again compiling "A")

module A:

callFuncmoduleB(params);

module B callFuncmoduleB

// Qt logic new Thread and Http requests using signal->slots. On finished Http request - parsing it callPARSEFuncmoduleB;

module B callPARSEfuncmoduleB:

callSETRESULTFuncmoduleA(result).....

module A:callSETRESULTFuncmoduleA

callsFuncModuleGUI and set results to GUI
Stepchik
  • 275
  • 1
  • 3
  • 14
  • Header files should solve that problem. – sharptooth Jul 15 '11 at 07:49
  • Hm... I including all header files in each projects. That is not problem compiling another if one of them already exists. The problem is how resolved compilation cyclic dependency for clean project. – Stepchik Jul 15 '11 at 08:34
  • Is the error reported by the compiler or by the linker? – Dan Jul 15 '11 at 08:54

1 Answers1

1

First of all, you really should try as hard as possible to not produce circular dependencies. There are a lot of ways around, and which one is best for you depends on the exact nature of your depedencies.

  • merge the two DLLs into one
  • use a callback mechanism (function pointers, some interface defined in B) to pass the dependency at run time e.g. callFunctionInB(args, callbackInA)
  • -

If you MUST have the circular dependencies, you will have to wade into the toolchain a bit deeper, starting here. In short, it is possible to create a stub .LIB file you need to link to a DLL without actually compiling the DLL.

Reference: circular dependencies between dlls with visual studio

Community
  • 1
  • 1
themel
  • 8,825
  • 2
  • 32
  • 31