If you compile with the /clr option, your code implicitly depends on the multithreaded DLL version of the C runtime libraries (CRT). This means that all files in your project—even those compiled without /clr—must use the multithreaded DLL version of the CRT.
Adding /MD to the compile command seems to fix it. Incidentally, this also seems to fix my earlier problems (here and here).
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.
Or is it possible to pass a managed object as a parameter to a native object's function?
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? 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.
I am a new C++ video game design student. I'm really not loving this C++ class cause my teacher is from tiawan and only knows like 100 words of english and when he puts them together in a sentence they are in the wrong order anyways. So i'm NOT understanding what it is he is telling us or asking of us. But i need help, or i need the code written for me or something. but we are on vectors and he wants us to make a list using 'iterators' that we can input our favorite video games. list them, and erase them. then he wants a quit fucntion to end the program.
You are not clear, but it sounds like you want the Standard Template Library (STL)
It a simple and easy to use library. here is a simple example for you, straight from the help files which you should probably read first before posting a question:
using namespace std;
int _tmain(int argc, _TCHAR* argv)
vector<int> myVector; // an empty string vector
vector<int>::iterator myIter; // an iterator for the string vector
I have a problem setting a class constant in my C# assembly to the value of a constant in a managed C++ class. The compiler does not seem to recognise that the managed C++ class constant is constant. The error message is shown below:
#error = "The expression being assigned to 'MyAssembly.SMyFooBar.bahName' must be constant
I am writing in Visual Studio 2003 on WinXP SP2 with .Net Framework V2.0.50727
What Have I done wrong here?
The reason for this attempt is that the majority of our code is unmanaged c++, which uses a glabal header file to set values through a number of projects.
I wish to include this header in our various new C# projects, and thus avoid double maintenance. If the header file changes, all that is needed is a code recompile, at least in theory.
To do this I wrapped the header file inside a managed c++ class to create a dll. I then included this dll as a reference in my C# project so that I could use it to initialise some c# constants, thus:
What is the best way to integrate an MFC-component in a .Net application?
The MFC-component I want to use resides in an mfc-dll and consists of many c++ classes with big usage of the MFC-classes. I tried so far to use IJW with MC++ wrapper classes but the application crashes all the time in some new and I don't want to use PInvoke because then I loose the object oriented design. How about converting the MFC-component into a COM object? Can I use the MFC-component this way in a .Net application?
U should be able to make it working through IJW. whats the erro u are getting? Though converting to COM is a possible alternative, as far as workload is concerned IJW is best. Performancewise also IJW is better than Com interop according to msdn.
I get lots of crashes related to new operators. Each time I allocated with new a CDC object, it might crash. I have the feeling that during the new operation there might be a conflict between the managed and unmanaged heap. Do you have any idea what i could do in this case?
the error is:
error C3363: 'void ClientRequestReceived(System::IAsyncResult __gc *)' : cannot create a delegate handler for 'System::AsyncCallback' from a non-member function or a member of an unmanaged class
how do i fix this error?
Thanx in advance
Upon my end shall i begin?
Forsaking all i've fallen for..
i rise to meet the END!!
% is for tracking references to CLI object
& is for passing native heap objects
If I use % and pass a native object, what is the compiled behavior? In other words given the following trivial example, does the code for x and y end up being the same, or does x box the passed value and then unbox it?
void Test(int% x, int& y)
int x = 0;
int y = 1;
// A bunch of stuff happens
// A bunch more stuff happens
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
i am infront of you with another doubt. We are using cin and cout in C++. Whether these are class or object.
if they are object how can we use them without declaring that it belongs to this class. Thanks for u in advance.