Link to home
Start Free TrialLog in
Avatar of dirtywerm
dirtywerm

asked on

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.

ASKER CERTIFIED SOLUTION
Avatar of pjknibbs
pjknibbs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of PlanetCpp
PlanetCpp

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\
Avatar of dirtywerm

ASKER

Yeah, i figured there wasn't any way to do it. Its not a com component.

Thanks