Call C# from C++(unmanaged)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jyotig

    #1

    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.
  • jyotig

    #2
    RE: Call C# from C++(unmanaged)

    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:
    [color=blue]
    > 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.[/color]

    Comment

    • Tom Shelton

      #3
      Re: Call C# from C++(unmanaged)

      On 2005-03-30, jyotig <jyotig@discuss ions.microsoft. com> wrote:[color=blue]
      > 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:
      >[color=green]
      >> 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.[/color][/color]

      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]

      Comment

      • Harish Shikhare

        #4
        RE: Call C# from C++(unmanaged)

        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:
        [color=blue]
        > 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:
        >[color=green]
        > > 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.[/color][/color]

        Comment

        Working...