• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 237
  • Last Modified:

Use a DLL without a header file

Is there anyway I can find the parameters and or return value of a function in a dll without the header file.  I want to use a dll and don't have access to the header file of library file.

  • 2
1 Solution
Well, yes and no. You can find out the names of the functions the DLL exports by using DUMPBIN (Visual C++) or a similar tool--unfortunately there's no information stored in the DLL about what parameters its functions take or what their return values are (unless the DLL in question is actually a COM component, in which case you access it in a completely different way in any case).
of course, you use loadlibrary. you need to know the name of the function , but you should know that anyway...
you use loadlibrary and save the HMODULE. the use GetProcAddress pass it the hmodule and the name of the function exactlly (maybe also try an alias if this returns NULL, check all returns before you use any pointers) you can create a pointer to the function like so
let's say the function returns long and take two integer parameters:
typedef long (WINAPI *_MyDllFunction)(int,int);
_MyDllFunction MyDllFunction;
set MyDllFunction = (_MyDllFunction)GetProcAddress(hmodulehere,"MyDllFunction");
assuming the address was returned correctlly you call it as normal:
somelong = MyDllFunction(5,5);
thats all.
i read your question wrong, but it can apply after you get the answer ;o\
dirtywermAuthor Commented:
Yeah, i figured there wasn't any way to do it. Its not a com component.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now