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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creating COM by using ATL dll to wrap C++ MFC unmanaged dll

Creating COM by using ATL dll to wrap C++ MFC unmanaged dll

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpvisual-studiocom
3 Posts 2 Posters 1 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.
  • M Offline
    M Offline
    Member 3480232
    wrote on last edited by
    #1

    I am in charge of a large number of dll's written in MFC. I have made a decision to convert them to COM interfaces. I studied the subject and decided ATL is the best answer. Problem is: I cannot call the old dll methods without getting a LNK2019 error. The IDE is VS2003. I read something about there being a issue with VS2003 with the 'attribute' keyword. A nudge in the right direction would be highly appreciated.

    R 1 Reply Last reply
    0
    • M Member 3480232

      I am in charge of a large number of dll's written in MFC. I have made a decision to convert them to COM interfaces. I studied the subject and decided ATL is the best answer. Problem is: I cannot call the old dll methods without getting a LNK2019 error. The IDE is VS2003. I read something about there being a issue with VS2003 with the 'attribute' keyword. A nudge in the right direction would be highly appreciated.

      R Offline
      R Offline
      Roger Stoltz
      wrote on last edited by
      #2

      Member 3480232 wrote:

      I cannot call the old dll methods without getting a LNK2019 error.

      Which means that you're doing implicit linking, i.e. you're not calling ::LoadLibrary() and ::GetProcAddress() to make use of your libraries. This also means that you need to link with the .lib file generated in the build process of the library you're trying to use. Now to the obvious question....: have you added the .lib file to the "additional libraries" in your project settings?

      "It's supposed to be hard, otherwise anybody could do it!" - selfquote
      "High speed never compensates for wrong direction!" - unknown

      M 1 Reply Last reply
      0
      • R Roger Stoltz

        Member 3480232 wrote:

        I cannot call the old dll methods without getting a LNK2019 error.

        Which means that you're doing implicit linking, i.e. you're not calling ::LoadLibrary() and ::GetProcAddress() to make use of your libraries. This also means that you need to link with the .lib file generated in the build process of the library you're trying to use. Now to the obvious question....: have you added the .lib file to the "additional libraries" in your project settings?

        "It's supposed to be hard, otherwise anybody could do it!" - selfquote
        "High speed never compensates for wrong direction!" - unknown

        M Offline
        M Offline
        Member 3480232
        wrote on last edited by
        #3

        Right on all counts. The original job was done by myself, so everything is as I hoped it should be. I also include the old job.h file with the cplusplus override added. Its obvious I am doing something wrong! As an afterthought, part of the decision to do this had to do with the schlepp of using LoadLibrary, GetProcAdress or DllImport and possibly speed of linking as well.

        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