tags:

views:

41

answers:

1

C#:

I have a standard win32 DLL from a vendor that talks to a hardware device. Is there any utility to automatically generate my interop code by discovering the exports in the DLL? This is not a COM dll. There is no def file, all I have is the DLL.

+1  A: 

In general, all you can do is find out the exported function names. even then, it's possible (but very, very unlikely) that the names aren't there (a DLL that has only ordinals).

The names may have clues to the parameters (with the size of the parameters, or the mangled C++ names), but getting the actual paramters from this information would either be painful and prone to error (C++ mangled names) or not possible (if only the size is encoded in the name).

If it were a COM DLL, you still wouldn't be guaranteed that you could get the information you need, but it would be more likely that there was a TLB or some other meteainfo about the DLL, either separately or embedded in the DLL.

Michael Burr