I would like to call a method from an dll, but i don\'t have the source neither the header file. I tried to use the dumpbin /exports to see the name of the method, but i can
The C++ language does not know anything about dlls.
Is this on Windows? One way would be to:
depends.exe
shipped with (Visual Studio)LoadLibrary()
to get load this dll (be careful about the path)GetProcAddress()
to get a pointer to the function you want to callFreeLibrary()
to release the handleBTW: This method is also commonly referred to as runtime dynamic linking as opposed to compile-time dynamic linking where you compile your sources with the associated
lib
file.
There exists some similar mechanism for *nixes with dlopen
, but my memory starts to fail after that. Something called objdump
or nm
should get you started with inspecting the function(s).