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 / C++ / MFC
  4. importing a .net dll into VC6

importing a .net dll into VC6

Scheduled Pinned Locked Moved C / C++ / MFC
comcsharpalgorithmshelpquestion
4 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
    Waldermort
    wrote on last edited by
    #1

    I have searching for hours now trying to figure this one out. I have a .NET dll, not my own, which I wish to import into my project. From what I have read, and I may be wrong, I need to import it as a COM object. So I have tried

    #import "net.dll"

    which results in: fatal error C1083: Cannot open type library file: 'net.dll': Error loading type library/DLL. This leads me to believe that the dll has no type library. When I have included my own VB dlls using the same method, I have no problems, the .tli and .tlb files are generated. Is there another way to do this?

    O M 2 Replies Last reply
    0
    • W Waldermort

      I have searching for hours now trying to figure this one out. I have a .NET dll, not my own, which I wish to import into my project. From what I have read, and I may be wrong, I need to import it as a COM object. So I have tried

      #import "net.dll"

      which results in: fatal error C1083: Cannot open type library file: 'net.dll': Error loading type library/DLL. This leads me to believe that the dll has no type library. When I have included my own VB dlls using the same method, I have no problems, the .tli and .tlb files are generated. Is there another way to do this?

      O Offline
      O Offline
      oshah
      wrote on last edited by
      #2

      You haven't yet created the Type library for the .NET DLL. To create a type library, you need to make use of the regasm.exe tool.

      regasm.exe net.dll

      Also make sure you have set the [ComVisible(true)] attribute

      1 Reply Last reply
      0
      • W Waldermort

        I have searching for hours now trying to figure this one out. I have a .NET dll, not my own, which I wish to import into my project. From what I have read, and I may be wrong, I need to import it as a COM object. So I have tried

        #import "net.dll"

        which results in: fatal error C1083: Cannot open type library file: 'net.dll': Error loading type library/DLL. This leads me to believe that the dll has no type library. When I have included my own VB dlls using the same method, I have no problems, the .tli and .tlb files are generated. Is there another way to do this?

        M Offline
        M Offline
        Michael Dunn
        wrote on last edited by
        #3

        You can't do .net programming with VC6. The best you can do is make the DLL have a CCW (COM callable wrapper) and then VC6 will see it as just another COM server.

        --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

        W 1 Reply Last reply
        0
        • M Michael Dunn

          You can't do .net programming with VC6. The best you can do is make the DLL have a CCW (COM callable wrapper) and then VC6 will see it as just another COM server.

          --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

          W Offline
          W Offline
          Waldermort
          wrote on last edited by
          #4

          Michael Dunn wrote:

          You can't do .net programming with VC6.

          does that mean I can't code VB in VC either :p The dll I am trying to use is from a sourceforge project which has been coded in C#. I do not have the means to compile from source therefore I have to download the precompiled version. So I suppose my question is, to make this work in my project, would I have to change anything within the .net dll?

          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