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. using an "unknown" DLL

using an "unknown" DLL

Scheduled Pinned Locked Moved C / C++ / MFC
wpfwcftoolshelpquestion
6 Posts 3 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
    reinhard_jd
    wrote on last edited by
    #1

    Hi all, I've got the following problem: I try to write an application which should use a specific function that is available in a DLL. Since I only need one of the various DLL functions and it is neccessary to create an EXE file as small as possible I thought about not binding the according LIB file into the project and loading the DLL at runtime. My problem is, that I can identify the function name within the DLL (by using DependencyWalker), but I don't know the function parameters (type and order) I have to use. I also don't know the type of the return value... :( Is there any possibility (some kind of utility prog or so...) to get some information about the parameters to use??? Many thanks in advance! Reinhard

    G J 2 Replies Last reply
    0
    • R reinhard_jd

      Hi all, I've got the following problem: I try to write an application which should use a specific function that is available in a DLL. Since I only need one of the various DLL functions and it is neccessary to create an EXE file as small as possible I thought about not binding the according LIB file into the project and loading the DLL at runtime. My problem is, that I can identify the function name within the DLL (by using DependencyWalker), but I don't know the function parameters (type and order) I have to use. I also don't know the type of the return value... :( Is there any possibility (some kind of utility prog or so...) to get some information about the parameters to use??? Many thanks in advance! Reinhard

      G Offline
      G Offline
      Ghasrfakhri
      wrote on last edited by
      #2

      it was my problem some month ago , I can't find any answer :^) Iman Ghasrfakhri

      1 Reply Last reply
      0
      • R reinhard_jd

        Hi all, I've got the following problem: I try to write an application which should use a specific function that is available in a DLL. Since I only need one of the various DLL functions and it is neccessary to create an EXE file as small as possible I thought about not binding the according LIB file into the project and loading the DLL at runtime. My problem is, that I can identify the function name within the DLL (by using DependencyWalker), but I don't know the function parameters (type and order) I have to use. I also don't know the type of the return value... :( Is there any possibility (some kind of utility prog or so...) to get some information about the parameters to use??? Many thanks in advance! Reinhard

        J Offline
        J Offline
        Jose Lamas Rios
        wrote on last edited by
        #3

        reinhard_jd wrote: My problem is, that I can identify the function name within the DLL (by using DependencyWalker), but I don't know the function parameters (type and order) I have to use. I also don't know the type of the return value... What exactly are you trying to do? Why do you want/need to call a function but you don't know about its parameters and return type? Even if you get the type and order of parameters, what values will you use? Even if you get the type of the return, what will you do with the returned value? reinhard_jd wrote: Since I only need one of the various DLL functions and it is neccessary to create an EXE file as small as possible I thought about not binding the according LIB file into the project and loading the DLL at runtime. So you have a lib for that DLL? Even if you used it instead of loading the DLL yourself, you'd still need some header file with the function prototype, or at least the information to declare the prototype yourself... You have the lib but not the header files? What's the DLL and what's the function? I really don't undertand your scenario... Or is this some kind of homework assignment? -- jlr http://jlamas.blogspot.com/[^]

        R 1 Reply Last reply
        0
        • J Jose Lamas Rios

          reinhard_jd wrote: My problem is, that I can identify the function name within the DLL (by using DependencyWalker), but I don't know the function parameters (type and order) I have to use. I also don't know the type of the return value... What exactly are you trying to do? Why do you want/need to call a function but you don't know about its parameters and return type? Even if you get the type and order of parameters, what values will you use? Even if you get the type of the return, what will you do with the returned value? reinhard_jd wrote: Since I only need one of the various DLL functions and it is neccessary to create an EXE file as small as possible I thought about not binding the according LIB file into the project and loading the DLL at runtime. So you have a lib for that DLL? Even if you used it instead of loading the DLL yourself, you'd still need some header file with the function prototype, or at least the information to declare the prototype yourself... You have the lib but not the header files? What's the DLL and what's the function? I really don't undertand your scenario... Or is this some kind of homework assignment? -- jlr http://jlamas.blogspot.com/[^]

          R Offline
          R Offline
          reinhard_jd
          wrote on last edited by
          #4

          Hi jlr, I thought that the short version of the story (i.e. the description of the actual problem) would do it, but here we go with the whole story... Years ago we developed a software which read some digital and analog values by using a special I/O card, analyzed the data and depending on the results of this reacted with screen and I/O outputs. We sold some dozen of the units (hardware and software) and still do service and further development for the solution. The card as well as the library (and the DLL) to read/write the ports were manufactured by a small German firm that doesn't exist anymore. Now we have do do some changes within the software and unfortunately it seems as if the (packed) EXE file becomes to large to fit onto a floppy disk. Since the machines we sold at that time didn't have a CD-ROM drive I thougth about how to create a smaller file... I don't have the source files of the driver/library and I also have no DEF file of the DLL. The only thing I have are some LIB files (for the different memory models), the DLL and a written documentation. :( I tried to call the DLL functions directly with the very same parameters as I have to use when using the LIB, but that didn't work. Therefore I search for a possibility to find out the type and order of the parameters I have to use when calling the DLL functions at runtime... Hope s/o can help me. Thanks and Greetings from Germany Reinhard

          J 1 Reply Last reply
          0
          • R reinhard_jd

            Hi jlr, I thought that the short version of the story (i.e. the description of the actual problem) would do it, but here we go with the whole story... Years ago we developed a software which read some digital and analog values by using a special I/O card, analyzed the data and depending on the results of this reacted with screen and I/O outputs. We sold some dozen of the units (hardware and software) and still do service and further development for the solution. The card as well as the library (and the DLL) to read/write the ports were manufactured by a small German firm that doesn't exist anymore. Now we have do do some changes within the software and unfortunately it seems as if the (packed) EXE file becomes to large to fit onto a floppy disk. Since the machines we sold at that time didn't have a CD-ROM drive I thougth about how to create a smaller file... I don't have the source files of the driver/library and I also have no DEF file of the DLL. The only thing I have are some LIB files (for the different memory models), the DLL and a written documentation. :( I tried to call the DLL functions directly with the very same parameters as I have to use when using the LIB, but that didn't work. Therefore I search for a possibility to find out the type and order of the parameters I have to use when calling the DLL functions at runtime... Hope s/o can help me. Thanks and Greetings from Germany Reinhard

            J Offline
            J Offline
            Jose Lamas Rios
            wrote on last edited by
            #5

            Ah, Ok. I was curious and couldn't understand your situation. reinhard_jd wrote: I tried to call the DLL functions directly with the very same parameters as I have to use when using the LIB, but that didn't work. Unless the lib had something more than a simple stub for the function in the DLL, that should have worked. How did you declare the function type? Perhaps you had a problem with the calling convention (i.e., cdecl Vs. pascal)? That affects the order in which the parameters are put in the stack before calling the function, and if I remember well, also which end of the call is responsible for removing the parameters from the stack. Maybe specifiying the correct calling convention is all that you need. For C++ functions, Dependency Walker can show you all the parameters and return type of each function if you press F10 or right-click and select "Undecorate C++ functions". However, that's not an option for C functions, which I suspect is what you have. reinhard_jd wrote: Thanks and Greetings from Germany Appreciated and returned from Uruguay, -- jlr http://jlamas.blogspot.com/[^]

            R 1 Reply Last reply
            0
            • J Jose Lamas Rios

              Ah, Ok. I was curious and couldn't understand your situation. reinhard_jd wrote: I tried to call the DLL functions directly with the very same parameters as I have to use when using the LIB, but that didn't work. Unless the lib had something more than a simple stub for the function in the DLL, that should have worked. How did you declare the function type? Perhaps you had a problem with the calling convention (i.e., cdecl Vs. pascal)? That affects the order in which the parameters are put in the stack before calling the function, and if I remember well, also which end of the call is responsible for removing the parameters from the stack. Maybe specifiying the correct calling convention is all that you need. For C++ functions, Dependency Walker can show you all the parameters and return type of each function if you press F10 or right-click and select "Undecorate C++ functions". However, that's not an option for C functions, which I suspect is what you have. reinhard_jd wrote: Thanks and Greetings from Germany Appreciated and returned from Uruguay, -- jlr http://jlamas.blogspot.com/[^]

              R Offline
              R Offline
              reinhard_jd
              wrote on last edited by
              #6

              Hi jlr, I've already tried both calling conventions. I suppose they did something more than only calling the DLL function from within the LIB file :sigh: Undecorating the C++ functions also didn't help... I hoped that there could be some way I didn't hear of until now to find out the parameters, but it seems as if there is nothing to do the trick. At the moment a colleague of mine is trying to find out who (in person) was the original creator of the library. Perhaps we can find it out by this way. :rolleyes: Once again thanks! Reinhard

              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