I have a 3rd party DLL that I am trying to use in a win32 C++ application. The DLL alone is all that I have. I believe this library is written in C and I assume is not exposed to COM. Is LoadLibrary() the function must commonly used for this task in Windows? If so can someone provide me with an example of how it is used?
I created a blank win32 in VS so I don’t have any of the windows specific headers included etc.
Thanks!
UPDATE
I want to add that I am trying use the SDL Library which appears to be very widely used. It seems odd that the vendor would not provide more than the DLL if more is necessary.
Simple DirectMedia Layer
Assuming that you do have access to a header file or have documentation that identifies the function and their parameters – here is what it looks like
Assume that the functions are as follows
int Func1 (int i1, int i2);
void Func2(void);
Now what follows is the example code
If you do not have access to the header file or know the functions signature – there are perhaps few ways to proceed
– Run a program which uses this function and break with a debugger when this function is called and see what it does.
– Use interactive disassembler (for example, IDA Pro), it can show the signature elements such as how many parameters are passed into a function.
– Disassembling the function to analyze its prologue and epilogue. Time consuming and not a trivial task, more so because of the different compilers, different calling conventions, optimized code packers, and so on.
– I have heard people say that they have used winedump – you can check it out here http://www.winehq.org/docs/winedump – I have never used it though. Nirsoft.net’s DLL Export Viewer is perhaps another tool.
– Also this is another tool- Visual dumpbin that uses UnDecorateSymbolName, the tool is available at http://code.entersources.com/f/Visual-Dumpbin-A-C–Visual-GUI-for-Dumpbin_2_1671_0.aspx. The DLL must be built by MS compiler. Check this link might give you some more clues, …