FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cyclic dependency between modules

 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
drobo



Joined: 17 Oct 2010
Posts: 3
Location: Oslo, Norway

PostPosted: Mon Oct 25, 2010 4:14 am    Post subject: cyclic dependency between modules Reply with quote

Hi

I'm trying to port a C library and I'm getting an error something like this:
module A cannot read file A.d

There is a cyclic dependency between two of the header files. Eg. they both include each other. Coming from C++ I find this to be bad design. Actually both the headers are quite large and each of them only seems to need a small potion of the other. I cannot with my best intention imagine how not factoring out the common pieces of code is anything else than lazyness.
Anyway, what i wanned to ask is if this cyclic dependency is considered bad practice in D, and if it could be the reason I get the error.

PS. I'm new to D and I find some error messages kind of confusing, so please bear with me if this is a no brainer
Back to top
View user's profile Send private message
mutable



Joined: 22 Jun 2010
Posts: 87

PostPosted: Mon Oct 25, 2010 6:34 pm    Post subject: Reply with quote

Try it with a private import. Otherwise post the code.
Back to top
View user's profile Send private message
drobo



Joined: 17 Oct 2010
Posts: 3
Location: Oslo, Norway

PostPosted: Mon Oct 25, 2010 8:25 pm    Post subject: Reply with quote

I managed to fix the error by using fully qualified names on the modules (wasn't sure if this was necessary as they were both in the same sub-folder)
That led me to another error along the lines of "module A conflicts with module A..."
so I figured I should combat the cyclic dependency by refactoring a couple of structs into a new module and import that. After that it works fine.

Anyway, thanks for the reply. I'll be sure to read up on private imports =)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group