RCIX
RCIX

Reputation: 39437

How does .NET allow API exploration of compiled DLLs?

How does .NET allow API exploration of compiled DLLs?

Upvotes: 2

Views: 193

Answers (4)

Abhijeet Patel
Abhijeet Patel

Reputation: 6878

One Word: Reflector

Upvotes: -1

Dave Van den Eynde
Dave Van den Eynde

Reputation: 17405

It depends.

A DLL contains a list of functions exported, but these can be simply assigned a number, a name, or they can be assigned a mangled C++ name. The latter can give some insight in the function's parameters, but data structures, calling conventions and other required attributes are generally not documented.

If it's a COM DLL, there's a possibility that it contains a Type Library as a resource, but this is not guaranteed. In that case, .NET can import the library quite automatically.

A Type Library can also be included in a non-COM DLL, but this is not a widespread practice.

If you have a compiled DLL designed to be called from a non-COM, non-managed environment, you'll need to translate the header files that should be included with the DLL.

Upvotes: 0

Mark Seemann
Mark Seemann

Reputation: 233150

I'm not sure if that is what you are asking about, but I can only recommend the free tool .NET Reflector that lets you explore any compiled .NET assembly.

These days, I use it much more than I use even the published MSDN documentation, because it's much faster to navigate around in, and more informative to boot.

Upvotes: 1

Jon Skeet
Jon Skeet

Reputation: 1500515

Because the DLL contains metadata about all the types, methods etc. Even the actual code is in IL rather than native code.

Basically a .NET binary is still at a higher level than a native binary, and contains a lot more information about what's in there. That's what allows Reflection to work.

Upvotes: 7

Related Questions