Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

C++ app hosts CLR 4 and invokes .NET assembly (using a thread)

$
0
0

I have a c++ application that I need to interface with a c# DLL.  I've used the example provided in the link below to load the CLR and call the member function (named "Run") that I need to from the c# DLL.  This works as expected.

http://code.msdn.microsoft.com/windowsdesktop/CppHostCLR-e6581ee0

However, it would be beneficial to me to call the function in the DLL (i.e, Run) in another thread.  If this were pure c# code, I would do something like:

Type type = assembly.GetType(assemblyName);
Object obj = Activator.CreateInstance(type, ServerIP, Port);
MethodInfo method = type.GetMethod("Run");
Thread thread = new Thread(delegate()
{
     method.Invoke(obj, null);
});
thread.Start();

How can I do something similar in c++ using the CLR (as demonstrated in the link)?

Thank you!


Viewing all articles
Browse latest Browse all 1710

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>