Click here to Skip to main content
15,899,474 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
QuestionODBC Native API Pin
Sk8tzz7-Aug-06 20:29
Sk8tzz7-Aug-06 20:29 
AnswerRe: ODBC Native API Pin
Eric Dahlvang15-Aug-06 7:18
Eric Dahlvang15-Aug-06 7:18 
QuestionPlaying PCM data Pin
t4ure4n7-Aug-06 4:52
t4ure4n7-Aug-06 4:52 
QuestionC++ to C# through dll Pin
t4ure4n6-Aug-06 11:26
t4ure4n6-Aug-06 11:26 
AnswerRe: C++ to C# through dll Pin
led mike7-Aug-06 6:15
led mike7-Aug-06 6:15 
QuestionSTL incompatible with Windows Forms? Pin
ricecake4-Aug-06 7:57
ricecake4-Aug-06 7:57 
AnswerRe: STL incompatible with Windows Forms? Pin
ricecake4-Aug-06 10:34
ricecake4-Aug-06 10:34 
Questionc++/cli interop: wrapper should be notified if native object changes Pin
Ralf A.4-Aug-06 5:33
Ralf A.4-Aug-06 5:33 
Hi,

I've got a problem with my wrapper class and my wrapped native object:
How can the wrapper be notified if the native object inside is modified?

Background: I want to wrap a library where an observer pattern is implemented. There the native observer observes a native subject where it was registered. If the subject notifies the registered observers about a change my observer-wrapper was not notified.
What should I do to make this work? I thought about something like function pointers and delegates but I think I'm on the wrong track. Frown | :(

Or is it possible to pass a managed object as a parameter to a native object's function?
Example:
class AbstractSubject
{
public:
	virtual ~AbstractSubject() {};
	virtual void Attach(IObserver*);
	virtual void Detach(IObserver*);
	virtual void Notify();
protected:
	AbstractSubject() {};
private:
	std::vector<IObserver*> observers;
};

class IObserver
{
public:
	virtual ~IObserver() {};	
	virtual void Update(AbstractSubject* theChangedSubject) = 0;
protected:
	IObserver() {};
};


As you can see the IObserver is a interface class. This interface class is wrapped by a managed c++ interface-class. The native observer object registeres itself on the Attach(IObserver*)-method and is added to the observers-vector.
If the Nofify()-method of the subject is called the subject iterates over the observers-vector and calls Update(this) (observerobject->Update(this)) on the observer object to notify the observer that something changed.

But how can I add now my managed class or my managed object to the subject to be notified? Confused | :confused: Please correct me when I'm wrong but I think I cannot pass the managed-observer-handle to the native method to notify the managed observer.

BTW: I don't have to source code for the native classes. I only have got a DLL-file, a LIB-file and some header-files to access the classes in the native lib.

Any help would be appreciated.

Thanks a lot for you help!

Best regards,
Ralf
QuestionVector list Pin
GameDesignerXIX3-Aug-06 16:43
GameDesignerXIX3-Aug-06 16:43 
AnswerRe: Vector list Pin
Christian Graus3-Aug-06 16:52
protectorChristian Graus3-Aug-06 16:52 
AnswerRe: Vector list Pin
OrcBighter23-Aug-06 20:07
OrcBighter23-Aug-06 20:07 
QuestionProblem including C++ code in C# assembly. Pin
OrcBighter23-Aug-06 15:42
OrcBighter23-Aug-06 15:42 
AnswerRe: Problem including C++ code in C# assembly. Pin
Milton Karimbekallil4-Aug-06 2:06
Milton Karimbekallil4-Aug-06 2:06 
GeneralRe: Problem including C++ code in C# assembly. Pin
OrcBighter26-Aug-06 18:27
OrcBighter26-Aug-06 18:27 
QuestionHow to integrate best an MFC-component in .Net? Pin
gunag3-Aug-06 3:06
gunag3-Aug-06 3:06 
AnswerRe: How to integrate best an MFC-component in .Net? Pin
Milton Karimbekallil4-Aug-06 1:22
Milton Karimbekallil4-Aug-06 1:22 
AnswerRe: How to integrate best an MFC-component in .Net? Pin
gunag5-Aug-06 0:53
gunag5-Aug-06 0:53 
GeneralRe: How to integrate best an MFC-component in .Net? Pin
Milton Karimbekallil7-Aug-06 0:00
Milton Karimbekallil7-Aug-06 0:00 
QuestionAsyncCallback constructor error Pin
DQ843-Aug-06 1:44
DQ843-Aug-06 1:44 
QuestionCan any "macro" take variable number of arguments? Pin
Pradosh Tapan Datta2-Aug-06 22:49
Pradosh Tapan Datta2-Aug-06 22:49 
AnswerRe: Can any "macro" take variable number of arguments? Pin
toxcct2-Aug-06 23:57
toxcct2-Aug-06 23:57 
AnswerRe: Can any "macro" take variable number of arguments? Pin
Michael Dunn4-Aug-06 14:10
sitebuilderMichael Dunn4-Aug-06 14:10 
GeneralRe: Can any "macro" take variable number of arguments? Pin
Pradosh Tapan Datta6-Aug-06 21:27
Pradosh Tapan Datta6-Aug-06 21:27 
QuestionConfusion about % vs. &amp; Pin
Joe Woodbury2-Aug-06 17:14
professionalJoe Woodbury2-Aug-06 17:14 
AnswerRe: Confusion about % vs. & Pin
Michael Dunn4-Aug-06 17:47
sitebuilderMichael Dunn4-Aug-06 17:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.