circular-dependency

boost::shared_ptr cycle break with weak_ptr

旧城冷巷雨未停 提交于 2019-12-13 12:38:48
问题 I am currently in a situation like: struct A { shared_ptr<B> b; }; struct B { shared_ptr<A> a; }; //... shared_ptr<A> a(new A()); shared_ptr<B> b(new B()); a->b(b); b->a(a); I know this won't work, because the references would continue to point to each other. I've also been told that weak_ptr solves this issue. However, weak_ptr has no get or -> overload. I've heard mentions of 'use lock() ', but can anyone give code examples of how to do this correctly? 回答1: Come on now. http://boost.org/doc

Makefile circular dependency

本小妞迷上赌 提交于 2019-12-13 11:51:05
问题 Here is my Makefile: .PHONY: all homework1 CFLAGS= -g -O0 -Wall -Werror -Wno-unused-function LDFLAGS= -lm all : homework1 homework1 : program.tab.o program.lex.o %.o : %.c gcc -o$@ -c $(CFLAGS) $< %.lex.c : %.lex %.tab.h flex -o$@ $< %.tab.c %.tab.h : %.y bison --verbose -o$@ -d $< Whenever I try to compile, I get the warning make: Circular program.lex <- program.lex.o dependency dropped. I don't see how program.lex is dependent on program.lex.o at all in the makefile. I see how the

To what extent can be this a bad practice? [circular dependence] [closed]

无人久伴 提交于 2019-12-13 08:07:54
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . (First and foremost, sorry for my English) In order to avoid the syntactic limitation of circular dependence, I want to know if the following proposed solution is really a solution or if it has more disadventages

How to fix a circular dependency for imports

北城余情 提交于 2019-12-13 07:25:36
问题 I have three files: testimports module: #import moduleTwo import moduleOne hiString = "Hi!" moduleOne.sayHi() moduleOne: import moduleTwo class sayHi(): moduleTwo.printHi() moduleTwo: import testimports def printHi(): print(testimports.hiString) If I run testimports , I get: Traceback (most recent call last): File "..file path snipped../testimports/src/testimports.py", line 2, in <module> import moduleOne File "..file path snipped../testimports/src/moduleOne.py", line 1, in <module> import

How does circular import work exactly in Python

守給你的承諾、 提交于 2019-12-13 04:24:34
问题 I have the following code (run with CPython 3.4): Basically the red arrows explain how I expected the import to work: h is defined before importing from test2. So when test2 imports test1 it's not an empty module anymore (with h) And h is the only thing that test2 wants. I think this contradicts with http://effbot.org/zone/import-confusion.htm Any hints? 回答1: What you're missing is the fact that from X import Y , does not solely imports Y . It imports the module X first . It's mentioned in

Get around 3rd party cyclic dll dependencies?

断了今生、忘了曾经 提交于 2019-12-12 18:02:22
问题 I am attempting to access text in a TE Edit (from ter32.dll) in a 3rd party application. (first post on this here) I looked through the API and tried to dynamically load the dll in order to access a function. Unfortunately, this (aftermarket rework) of ter32.dll has a load of dependencies. I tried dynamically loading each required dll as needed but ran into a cyclic dependency. ter32.dll requires x. x requires y. y won't load because it requires x. Would I have to statically load these with a

Solving circular project dependency between C# and C++/CLI projects?

感情迁移 提交于 2019-12-12 17:20:57
问题 We have a solution with a number of projects. In one particular case, we have two projects: 1) A C# project that does most of the work 2) A C++/CLI project that acts as a go-between to some native C++ code The C# code calls into the C++ wrapper, all is well. However, there is some new functionality that we are pulling in. On the managed side of the C++ wrapper (project #2), it requires some static methods in the managed C# code that is in project #1. However, Visual Studio will not let us

Ada: how to solve “Circular Unit Dependency”?

不打扰是莪最后的温柔 提交于 2019-12-12 13:48:38
问题 Suppose I have two records: Person and Animal . Each record is in a separate package. Package persons: with animals; use animals; package persons is type person is record ... animalref: animalPOINTER; ... end record; type personPOINTER is access person; end persons; Package animals: with persons; use persons; package animals is type animal is record ... ownerref: personPOINTER; ... end record; type animalPOINTER is access animal; end animals; I have Circular Unit Dependency here, and compiler

Javascript circular dependency in GraphQL code

只谈情不闲聊 提交于 2019-12-12 13:40:03
问题 I am new to Javascript and don't know how to solve this problem. I am creating a GraphQL service to provide query to a database, I would like to define three type: Person, Company and Relationship type Relation: { person: Person company: Company } type Person: { relationship: Relation } type Company: { relationship: Relation } As you can see, they are mutually depended, I will got Person and Company undefined , is there a way to resolve this? database schema: // -------------------- Object

Circular dependency tree, justified or not

冷暖自知 提交于 2019-12-12 11:49:11
问题 I've came up with some solution on which my IoC/DI container ( Castle Windsor ) is claiming that there's a cyclic dependency tree. And it's true. But I'm not that sure that this cycle is that harmful. This is, more or less, the dependency tree: A WebAPI controller depends on... ...a service A depends on... ...an unit of work depends on... ...a repository depends on... ...a domain event manager (1) depends on many... ...domain event handlers, and one depends on... ... service A (2) (1) A