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. Explicit DLL call...

Explicit DLL call...

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 Posts 2 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.
  • R Offline
    R Offline
    Raphael Kindt
    wrote on last edited by
    #1

    Hi, Is it possible to call explicitly a class from a DLL (not a simple C function but a C++ class)? I suppose we must use ::Loadlibrary("my_dll_path_to_call") and GetProcAddress(hInstance, "class_name_from_dll")... like the call of a simple C function! Thanks for your suggestion. Hello World!!! :) from Raphaël

    J 1 Reply Last reply
    0
    • R Raphael Kindt

      Hi, Is it possible to call explicitly a class from a DLL (not a simple C function but a C++ class)? I suppose we must use ::Loadlibrary("my_dll_path_to_call") and GetProcAddress(hInstance, "class_name_from_dll")... like the call of a simple C function! Thanks for your suggestion. Hello World!!! :) from Raphaël

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Even if this was possible, what would you do with the result of GetProcAddress(hInstance, "class_name_from_dll")? Think it over, a class is not an entity per se in a program, only their instance objects (The situation differs in Java and C#, where classes are program entities). GetProcAddress will give you pointers to functions, with a little work it is possible to make it return pointers to the methods of a given class: if this is what's in your mind, you might consider exporting classes from a DLL (see the docs), but this is a whole different beast than you're asking for. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      R 1 Reply Last reply
      0
      • J Joaquin M Lopez Munoz

        Even if this was possible, what would you do with the result of GetProcAddress(hInstance, "class_name_from_dll")? Think it over, a class is not an entity per se in a program, only their instance objects (The situation differs in Java and C#, where classes are program entities). GetProcAddress will give you pointers to functions, with a little work it is possible to make it return pointers to the methods of a given class: if this is what's in your mind, you might consider exporting classes from a DLL (see the docs), but this is a whole different beast than you're asking for. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        R Offline
        R Offline
        Raphael Kindt
        wrote on last edited by
        #3

        Yeap... It's true... I had forgotten this... Thanks. (I think that I will sleep early today :zzz: ) Hello World!!! :) from Raphaël

        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