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. DLL calback functions

DLL calback functions

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

    Hello! I want to write some aplication for example some proprietary TCP client that will connect to some server and receive and send messages. I want this functionality to be encapsulated in DLL library. Some GUI client will load this DLL and call its functions. So far so good. But here is a problem...when TCP client receives some message, I want it to notify GUI client trough some kind of callback function. How do I do that? How do I call a function that is implemented in GUI part from TCP client DLL? I know I did something like that long ago when I was learning about DLL from MSDN article. I can't find this article now. I checked local and internet version of MSDN, but I just can't find it. The title was something like "Introduction to DLL's" or something like that and contained nice pictures of text and data segments mappings. If somebody knows this article please direct me to it. Best regards, Rostfrei

    K 1 Reply Last reply
    0
    • R Rostfrei

      Hello! I want to write some aplication for example some proprietary TCP client that will connect to some server and receive and send messages. I want this functionality to be encapsulated in DLL library. Some GUI client will load this DLL and call its functions. So far so good. But here is a problem...when TCP client receives some message, I want it to notify GUI client trough some kind of callback function. How do I do that? How do I call a function that is implemented in GUI part from TCP client DLL? I know I did something like that long ago when I was learning about DLL from MSDN article. I can't find this article now. I checked local and internet version of MSDN, but I just can't find it. The title was something like "Introduction to DLL's" or something like that and contained nice pictures of text and data segments mappings. If somebody knows this article please direct me to it. Best regards, Rostfrei

      K Offline
      K Offline
      ky_rerun
      wrote on last edited by
      #2

      define a register callback function that take a function pointer as a paramater and export it out of the dll. EX bool RegisterCallback(bool (*FP)(void *,const char *,const char *),void * passin) This defines a function that takes a void pointer and a pointer function that returns a bool and takes a void pointer and two character pointers. I have found that when you define a function that takes a call back you should allways have a void pointer in the callback deffinition and in the called function so you have some way to pass data into the callback.:suss:


      a programmer traped in a thugs body

      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