Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Use .Net library in C++

Use .Net library in C++

Scheduled Pinned Locked Moved C#
questioncsharpc++
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    Ward 0
    wrote on last edited by
    #1

    How can I use a .NET dll in a C++ application?

    Ward

    Q N 2 Replies Last reply
    0
    • W Ward 0

      How can I use a .NET dll in a C++ application?

      Ward

      Q Offline
      Q Offline
      quiteSmart
      wrote on last edited by
      #2

      Just use the C++ in the .NET environment. Install the Visual Studio .Net and use the C++ over three :):):) jamil abou khalil MSN: jamilaboukhalil@hotmail.com

      1 Reply Last reply
      0
      • W Ward 0

        How can I use a .NET dll in a C++ application?

        Ward

        N Offline
        N Offline
        Nader Elshehabi
        wrote on last edited by
        #3

        Hello Sorry! You can't! .Net dlls are managed code. You know you can call unmanaged code by P/Invoke, but not vice versa. If there is a managed code that you want to use, maybe you could make it a service or a commandline console application, then you can communicate with it from your C++ program.

        Regards:rose:

        W 1 Reply Last reply
        0
        • N Nader Elshehabi

          Hello Sorry! You can't! .Net dlls are managed code. You know you can call unmanaged code by P/Invoke, but not vice versa. If there is a managed code that you want to use, maybe you could make it a service or a commandline console application, then you can communicate with it from your C++ program.

          Regards:rose:

          W Offline
          W Offline
          Ward 0
          wrote on last edited by
          #4

          I've searched some documentation and I was able to do it. The trick is to register the .Net dll as a COM server. But to be able to register it as a COM server you must first have a tlb file of it. This tlb file you can create with the visual studio tool tlbexp.exe. From the command prompt: tlbexp dotNET.dll /win32 /out:dotNET.tlb Once you have the tlb file you can use regasm to register the .Net dll as a COM server. You will not be able to run regasm from the windows command prompt. You must launch the visual studio command prompt to do this. In the visual studio command prompt type: regasm dotNET.dll /tlb:dotNET.tlb From this point you can use the classes and functions of the .Net dll is whatever language that understands COM. Kind regards,

          Ward

          N 1 Reply Last reply
          0
          • W Ward 0

            I've searched some documentation and I was able to do it. The trick is to register the .Net dll as a COM server. But to be able to register it as a COM server you must first have a tlb file of it. This tlb file you can create with the visual studio tool tlbexp.exe. From the command prompt: tlbexp dotNET.dll /win32 /out:dotNET.tlb Once you have the tlb file you can use regasm to register the .Net dll as a COM server. You will not be able to run regasm from the windows command prompt. You must launch the visual studio command prompt to do this. In the visual studio command prompt type: regasm dotNET.dll /tlb:dotNET.tlb From this point you can use the classes and functions of the .Net dll is whatever language that understands COM. Kind regards,

            Ward

            N Offline
            N Offline
            Nader Elshehabi
            wrote on last edited by
            #5

            Truely I solute you. I really urge you to write an article about it in CodeProject with more details. Many people will miss this old post. I've allowed myself to bookmark this post for future referal. Really brilliant.

            Regards:rose:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups