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. ACCESSING METHOD EXPORT in CLASS in DLL

ACCESSING METHOD EXPORT in CLASS in DLL

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • K Offline
    K Offline
    Killer3
    wrote on last edited by
    #1

    The above class is export in a dll . So should i add new function to the dll ? Can i have a sample code that achieves it? class __declspec(dllexport) MyClass { public: static char* LSGDecrypt(const char* key,const char* hex); static char* LSGEncrypt(const char* key,const char* source); } Iam about access a static function So is that required to instantiate the class object. HINSTANCE hDLL; // Handle to DLL LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer char* key = new char [50]; key ="KEYVAULE"; char* strPlain = new char [50]; strPlain="password"; char* strResult = new char [50]; DWORD dwrd =NULL; hDLL = LoadLibrary("Mydll.dll"); if (hDLL != NULL) { lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"LSGEncrypt"); if (lpfnDllFunc1 ==NULL) // Fails here? so DLL is freed up? { FreeLibrary(hDLL); } else strResult = lpfnDllFunc1("killer" ,"strikes HERE"); } for thendral

    P 1 Reply Last reply
    0
    • K Killer3

      The above class is export in a dll . So should i add new function to the dll ? Can i have a sample code that achieves it? class __declspec(dllexport) MyClass { public: static char* LSGDecrypt(const char* key,const char* hex); static char* LSGEncrypt(const char* key,const char* source); } Iam about access a static function So is that required to instantiate the class object. HINSTANCE hDLL; // Handle to DLL LPFNDLLFUNC1 lpfnDllFunc1; // Function pointer char* key = new char [50]; key ="KEYVAULE"; char* strPlain = new char [50]; strPlain="password"; char* strResult = new char [50]; DWORD dwrd =NULL; hDLL = LoadLibrary("Mydll.dll"); if (hDLL != NULL) { lpfnDllFunc1 = (LPFNDLLFUNC1)GetProcAddress(hDLL,"LSGEncrypt"); if (lpfnDllFunc1 ==NULL) // Fails here? so DLL is freed up? { FreeLibrary(hDLL); } else strResult = lpfnDllFunc1("killer" ,"strikes HERE"); } for thendral

      P Offline
      P Offline
      Parthiban
      wrote on last edited by
      #2

      hi young breeze, U can use static linking for the dll. so that u don't require to get the function ptr for the LSGEncrypt funtion. Natpudan, Parthiban

      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