call c# from managed c++ dll
-
i have a managed c++ dll, now i need to call a c# method(not in dll) from the managed c++ dll. how would i go about it? i cannot find anything on this topic, everywhere people call from unmanaged c++.
rather have something you don't need, than need something you don't have
-
i have a managed c++ dll, now i need to call a c# method(not in dll) from the managed c++ dll. how would i go about it? i cannot find anything on this topic, everywhere people call from unmanaged c++.
rather have something you don't need, than need something you don't have
Hi again, you can mix all managed languages in one app, provided you use dll's. Each dll/exe can contain only one language. Calling C# from managed C++ is identical to calling managed C++ from C#. :)
Luc Pattyn [My Articles]
-
Hi again, you can mix all managed languages in one app, provided you use dll's. Each dll/exe can contain only one language. Calling C# from managed C++ is identical to calling managed C++ from C#. :)
Luc Pattyn [My Articles]
thanks again for your reply. only problem is that the c# code is not a dll, can i add a reference to a c# exe in a managed c++ dll?
rather have something you don't need, than need something you don't have
-
thanks again for your reply. only problem is that the c# code is not a dll, can i add a reference to a c# exe in a managed c++ dll?
rather have something you don't need, than need something you don't have
thanks for the help, i added a reference to the c# exe and it works!
rather have something you don't need, than need something you don't have
-
thanks again for your reply. only problem is that the c# code is not a dll, can i add a reference to a c# exe in a managed c++ dll?
rather have something you don't need, than need something you don't have
Hi, if your app is basically a C# program that calls a C++ dll, and that dll needs to call back some method in the C# exe, then AFAIK you need to pass a delegate and use it as a function pointer (or whatever it is called nowadays) in the C++ part. Since the delegate type must be known to both the exe and the dll, it seems it must be defined in the dll (again I dont know the details). A more general approach would be to create an additional dll that holds the C# code that is needed by both the C# main part and the C++ dll. Doing so allows the C++ project (and the main C# part) to add a reference to the new C# dll. :)
Luc Pattyn [My Articles]