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. Managed C++/CLI
  4. Using DLL's in Managed C++

Using DLL's in Managed C++

Scheduled Pinned Locked Moved Managed C++/CLI
c++questioncsharphelp
2 Posts 2 Posters 2 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    In Visual C++ .Net we created a managed class, whose definition is in myclass.h, and implementation is in myclass.cpp. After that we created a library based on these files (DLL). Now we want to use this class in our application (EXE). We perform compilation from a command line (it is a requirement). In our application, we write #include "myclass.h" and also #using "mydll.dll", but now we get an error during compilation. Compiler generates an error because declaration of our class is both in the header and the DLL, since we used #using directive. But if we remove #using, then compiler does not understand where our class' members are. Thus, we should not include our header file, but should add an option /FUmydll.dll to the compiler (cl.exe), then everything works. Question: is it possible to avoid adding a compiler option /FU, so that we could include our header file in our application and the DLL was linked dynamically (i.e., during run-time as in MFC), not statically? In other words, is it possible to use #include instead of #using as in MFC?

    A 1 Reply Last reply
    0
    • L Lost User

      In Visual C++ .Net we created a managed class, whose definition is in myclass.h, and implementation is in myclass.cpp. After that we created a library based on these files (DLL). Now we want to use this class in our application (EXE). We perform compilation from a command line (it is a requirement). In our application, we write #include "myclass.h" and also #using "mydll.dll", but now we get an error during compilation. Compiler generates an error because declaration of our class is both in the header and the DLL, since we used #using directive. But if we remove #using, then compiler does not understand where our class' members are. Thus, we should not include our header file, but should add an option /FUmydll.dll to the compiler (cl.exe), then everything works. Question: is it possible to avoid adding a compiler option /FU, so that we could include our header file in our application and the DLL was linked dynamically (i.e., during run-time as in MFC), not statically? In other words, is it possible to use #include instead of #using as in MFC?

      A Offline
      A Offline
      Anders Molin
      wrote on last edited by
      #2

      zaza_nata wrote: In other words, is it possible to use #include instead of #using as in MFC? The short answar: No... - Anders Money talks, but all mine ever says is "Goodbye!"

      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