tags:

views:

25

answers:

1

I'm writing code that requires a DLL that exists only on Windows 7. However, I will deploy to older platforms, so I want to use the DLL if it exists on the user's system.

I can use LoadLibrary() to get a HMODULE, and GetProcAddress() to get methods from that HMODULE. This allows me to get the method, and it will still compile. But how do I declare a type of struct or class defined in that DLL and have it compile?

A: 

Generally you will know what methods you are using and either have a header file with the types that you need defined. You just need to define fn pointers that you can assign the return of getprocaddress to. If you don't have a header file or some documentation you are in discovery land will need to experiment.

rerun