469,356 Members | 2,012 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

Call C# from C++(unmanaged)

Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.
Jul 21 '05 #1
3 8778
Ok, I found the following article on MSDN. It explains using managed code
from unmanaged code and vice versa. But the code to be used has to be a COM
component. If anyone knows any solution that does not require the managed
classes to be converted to COM component, please let me know.

http://msdn.microsoft.com/library/de...anagedCode.asp

Thanks
-Jyoti.

"jyotig" wrote:
Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.

Jul 21 '05 #2
On 2005-03-30, jyotig <jy****@discussions.microsoft.com> wrote:
Ok, I found the following article on MSDN. It explains using managed code
from unmanaged code and vice versa. But the code to be used has to be a COM
component. If anyone knows any solution that does not require the managed
classes to be converted to COM component, please let me know.

http://msdn.microsoft.com/library/de...anagedCode.asp

Thanks
-Jyoti.

"jyotig" wrote:
Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.


Hmmm, the only thing I can think of is for you to host the runtime in
your process...

http://msdn.microsoft.com/library/de...ageruntime.asp

might be a good place to start :)
--
Tom Shelton [MVP]
Jul 21 '05 #3
Jyoti,

If you have C++ code with you then you can compile same C++ (Legacy)code
under VS .NET compiler with /Clr switch
Look for documentation here from MSDN :
http://msdn.microsoft.com/library/de...ompilation.asp

I tried achieve same goal last year and some of the steps I have documented
in my blog http://harishds.weblogs.us/archives/2004_04.html
Harish
"jyotig" wrote:
Ok, I found the following article on MSDN. It explains using managed code
from unmanaged code and vice versa. But the code to be used has to be a COM
component. If anyone knows any solution that does not require the managed
classes to be converted to COM component, please let me know.

http://msdn.microsoft.com/library/de...anagedCode.asp

Thanks
-Jyoti.

"jyotig" wrote:
Can I call C# code from unmanaged C++ code? If yes, how?

I saw the same question posted in this newsgroup last year but there was no
useful answer there, so posting it again hoping someone might have tried it
by now and knows the answer.

Thanks
-Jyoti.

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Gnanaprakash Rathinam | last post: by
3 posts views Thread by rasa | last post: by
4 posts views Thread by Andreas Ntalakas | last post: by
28 posts views Thread by Peter Olcott | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.