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. How to Call a static member variable from another DLL

How to Call a static member variable from another DLL

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
2 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.
  • U Offline
    U Offline
    uday kiran janaswamy
    wrote on last edited by
    #1

    hi all, i am having Two DLL's and in one Dll i am having a Class, in that Class i am having a static member variable. Now in another DLL's Class i want to acess the One's (First Dll's) static member variable. //---------------------------------------------------------- First DLL, Class One { static int onevar; } //---------------------------------------------------------- my question is in the second Dll Class Two { // I want to dynamically link only the First Member Variable. } Please give any code such that i can access the First DLL static Member Variable in the Second DLL. Any Import Techinique.

    Uday kiran

    G 1 Reply Last reply
    0
    • U uday kiran janaswamy

      hi all, i am having Two DLL's and in one Dll i am having a Class, in that Class i am having a static member variable. Now in another DLL's Class i want to acess the One's (First Dll's) static member variable. //---------------------------------------------------------- First DLL, Class One { static int onevar; } //---------------------------------------------------------- my question is in the second Dll Class Two { // I want to dynamically link only the First Member Variable. } Please give any code such that i can access the First DLL static Member Variable in the Second DLL. Any Import Techinique.

      Uday kiran

      G Offline
      G Offline
      Gupta Suraj
      wrote on last edited by
      #2

      example #define TESTDLL_API __declspec(dllexport) //Testdll.h class TESTDLL_API CTestDLL { public: CTestDLL(void); static int m_i; // TODO: add your methods here. }; //Testdll.cpp TESTDLL_API int CTestDLL::m_i=0; In DLL two, where you are going to use this header file and define TESTDLL_API macro as __declspec(dllimport).... Hope this helps.. Thanks... Please let me know if you have some doubt....

      Suraj Gupta

      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