Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modules that USE eachother and thus don't compile ever

Status
Not open for further replies.

GerritGroot

Technical User
Nov 3, 2006
291
ES
Imagine that I have got two modules

Module 1 in which I use a part of Module 2 and Module 2 in which I use a part of Module 1.

I can't compile, neither module1 nor module2, because the compiler will tell me that it misses the compiled version of the other module that it needs.

What is the usual way to get around this?
 
Good question. That sort of problem has always led me to restructure the modules to not be dependent on each other that way. I wonder if there is a "proper" solution to that problem...

--------------------------------------
Background: Chemical engineer, familiar mostly with MATLAB, but now branching out into real programming.
 
Well in fact, while developing my code I made the modules mutually dependent without even noticing it, but as it was constructed slowly and te mod files already existed, the compiler didn't complain about the mutual dependency. ...and it all worked fine...

It stopped being able to compile it when I took ik to another directory without mod or objectfiles. Regenerating everything, the compiler got stuck on the mutual dependencies.
 
If the procedures are mutually recursive, they should be in the same module.

This method sort of works but it depends on what else the mutually recursive routines call. Say you have 2 mutually dependent modules A and B. Move the routines in A that call B into C. Similarly move the routines in B that call A into C. Both A and B use C.
 
Thanks!

It keeps on being strange that it IS possible and works (though conceptually wrong) as long as a previous (non-dependent) *.mod file is available at the moment of compiling. If you then recompile, you end up with everything updated and still mutually dependent.

Anyway, in stead of merging the modules, I took the one and only routine that caused it out of its module and must admit that the compiler was right. It didn't really belong there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top