multithreading - C++ How to make a dll modify a variable from main thread? -
I currently have a DLL which helps me with some tasks, and I want my DLL main thread . Do I send classes in some way (in a variable, there is a type name for a class), I would also like to include DLL in the file where the class is defined (.h file).
So basically, how can I modify a variable from any other thread (in this case, the main thread)?
Edit:
The variable that I want to change is as follows:
Group The group is a template class and UMesh is another class. Do I somehow send a DLL to a class (a type of typed name in a type) in a variable? Yes, should I include DL files, where the class is defined (.h file). No, you can not rely on your library some application types. Why would this library be useful for other applications? Your library will accept only this type of object known in this library. Then, you have been typed in your application: And you want some libraries to accept this type of object. There are two specific solutions: First Solution , name this object-oriented solution, create an interface in your library and implement this interface Object accepting function: To use Or (I like it) create an adapter in this interface from your class: The second solution , give it a general solution, since you have a template class, so it would be better for this particular case. Create a function template in your library by accepting any type of interface: If your T & gt; Interface This method is not required, so make an adapter like the first solution - but this time there is no clear interface class and no virtualization: With BTW, Object Interface I mean that all public functions that work on its object and all global functions (such as
template & lt; Class T & gt; Class group;
class SomInterface {public: virtual void foo1 () = 0; Virtual zero foo2 () = 0; }; Nothing to do (some difference and object);
doSomething in your application, either your class will be available from this interface:
template & Lt; Class T & gt; Class Group: Public Some Interface {Public: Virtual Zero (foo1) {...} Virtual Zeros Foo2 () {...}}; Group's & lt; Umesh & gt; thing; DoSomething (object);
template < Class T & gt; Class Group Some Interface: Public Some Interface {Public: GroupSome Interfaces (Group & lt; UMesh & Object): Object (Object) {} Virtual Zero Foo1 () {...} Virtual Zeros Foo2 () {...} Private: Groups & lt; UMesh & amp; thing; }; Group's & lt; Umesh & gt; thing; GroupSomeInterface & LT; Umesh & gt; Adapter (object); DoSomething (adapter);
template & lt; Class T & gt; Nothing to be done (T & O); Group's & lt; Umesh & gt; thing; DoSomething (object);
group
template & lt; Class T & gt; Group group Soma Infrapase {Public: Group Somenters (Group & lt; UMesh & Object): Object (object) void foo1 () {...} void foo2 () {...} Private: Groups & lt ; UMesh & amp; thing; }; Group's & lt; Umesh & gt; thing; GroupSomeInterface & LT; Umesh & gt; Adapter (object); DoSomething (adapter);
operator example)
Comments
Post a Comment